Class: Shaf::App
- Inherits:
-
Object
- Object
- Shaf::App
- Defined in:
- lib/shaf/app.rb
Class Method Summary collapse
-
.call(*args) ⇒ Object
Or ‘run Shaf::App` (in config.ru).
- .instance ⇒ Object
-
.run! ⇒ Object
Either call ‘Shaf::App.run!`.
- .use(middleware, *args, **kwargs, &block) ⇒ Object
Class Method Details
.call(*args) ⇒ Object
Or ‘run Shaf::App` (in config.ru)
12 13 14 |
# File 'lib/shaf/app.rb', line 12 def call(*args) instance.call(*args) end |
.instance ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/shaf/app.rb', line 16 def instance # This works since Sinatra includes Sinatra::Delegator into # Rack::Builder, which means that Rack::Builder#set will be delegated # to Sinatra::Application @instance ||= Rack::Builder.new(app) do set :port, Settings.port || 3000 end end |
.run! ⇒ Object
Either call ‘Shaf::App.run!`
7 8 9 |
# File 'lib/shaf/app.rb', line 7 def run! instance.run! end |
.use(middleware, *args, **kwargs, &block) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/shaf/app.rb', line 25 def use(middleware, *args, **kwargs, &block) if args.empty? && kwargs.empty? instance.use middleware, &block elsif kwargs.empty? instance.use middleware, *args, &block elsif args.empty? instance.use middleware, **kwargs, &block else instance.use middleware, *args, **kwargs, &block end end |