Class: Nested::App
- Inherits:
-
Object
- Object
- Nested::App
- Extended by:
- WithMany, WithSingleton
- Defined in:
- lib/nested/app.rb
Class Method Summary collapse
- .after(&block) ⇒ Object
- .before(&block) ⇒ Object
- .child_resource(name, clazz, resource_if_block, model_block, &block) ⇒ Object
- .config(opts = {}) ⇒ Object
- .inherited(clazz) ⇒ Object
Methods included from WithSingleton
Methods included from WithMany
Class Method Details
.after(&block) ⇒ Object
20 21 22 |
# File 'lib/nested/app.rb', line 20 def self.after(&block) sinatra.after(&block) end |
.before(&block) ⇒ Object
16 17 18 |
# File 'lib/nested/app.rb', line 16 def self.before(&block) sinatra.before(&block) end |
.child_resource(name, clazz, resource_if_block, model_block, &block) ⇒ Object
11 12 13 14 |
# File 'lib/nested/app.rb', line 11 def self.child_resource(name, clazz, resource_if_block, model_block, &block) clazz.new(sinatra, name, nil, resource_if_block, model_block) .tap{|r| r.instance_eval(&(block||Proc.new{ }))} end |
.config(opts = {}) ⇒ Object
24 25 26 |
# File 'lib/nested/app.rb', line 24 def self.config(opts={}) @config.tap{|c| c.merge!(opts)} end |
.inherited(clazz) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/nested/app.rb', line 3 def self.inherited(clazz) (class << clazz; self; end).instance_eval do attr_accessor :sinatra end clazz.sinatra = Class.new(Sinatra::Base) clazz.instance_variable_set("@config", {}) end |