123456789_123456789_123456789_123456789_123456789_

Module: Sinatra::Contrib::Loader

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Extended In:
Defined in: sinatra-contrib/lib/sinatra/contrib/setup.rb

Instance Method Summary

Instance Method Details

#autoload(name, path, method = nil)

[ GitHub ]

  
# File 'sinatra-contrib/lib/sinatra/contrib/setup.rb', line 21

def autoload(name, path, method = nil)
  extensions[method] << name if method
  Sinatra.autoload(name, path)
end

#extensions

[ GitHub ]

  
# File 'sinatra-contrib/lib/sinatra/contrib/setup.rb', line 9

def extensions
  @extensions ||= { helpers: [], register: [] }
end

#helpers(name, path)

[ GitHub ]

  
# File 'sinatra-contrib/lib/sinatra/contrib/setup.rb', line 17

def helpers(name, path)
  autoload name, path, :helpers
end

#register(name, path)

[ GitHub ]

  
# File 'sinatra-contrib/lib/sinatra/contrib/setup.rb', line 13

def register(name, path)
  autoload name, path, :register
end

#registered(base)

[ GitHub ]

  
# File 'sinatra-contrib/lib/sinatra/contrib/setup.rb', line 26

def registered(base)
  @extensions.each do |method, list|
    list = list.map { |name| Sinatra.const_get name }
    base.send(method, *list) unless base == ::Sinatra::Application
  end
end