Module: Sinatra::Contrib::Loader
- Included in:
- Sinatra::Contrib, Common, Custom
- Defined in:
- lib/sinatra/contrib/setup.rb
Instance Method Summary collapse
- #autoload(name, path = nil, method = nil) ⇒ Object
- #extensions ⇒ Object
- #helpers(name, path = nil) ⇒ Object
- #register(name, path = nil) ⇒ Object
- #registered(base) ⇒ Object
Instance Method Details
#autoload(name, path = nil, method = nil) ⇒ Object
20 21 22 23 24 |
# File 'lib/sinatra/contrib/setup.rb', line 20 def autoload(name, path = nil, method = nil) path ||= "sinatra/#{name.to_s.underscore}" extensions[method] << name if method Sinatra.autoload(name, path) end |
#extensions ⇒ Object
8 9 10 |
# File 'lib/sinatra/contrib/setup.rb', line 8 def extensions @extensions ||= {:helpers => [], :register => []} end |
#helpers(name, path = nil) ⇒ Object
16 17 18 |
# File 'lib/sinatra/contrib/setup.rb', line 16 def helpers(name, path = nil) autoload name, path, :helpers end |
#register(name, path = nil) ⇒ Object
12 13 14 |
# File 'lib/sinatra/contrib/setup.rb', line 12 def register(name, path = nil) autoload name, path, :register end |