Module: Rack::App::Test::SingletonMethods
- Defined in:
- lib/rack/app/test/singleton_methods.rb
Instance Method Summary collapse
Instance Method Details
#in_this_context(name, &block) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/rack/app/test/singleton_methods.rb', line 14 def in_this_context(name, &block) if respond_to?(:let) let(name, &block) else define_method(name, &block) end end |
#rack_app(rack_app_class = nil, &constructor) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/rack/app/test/singleton_methods.rb', line 3 def rack_app(rack_app_class=nil, &constructor) klass = if !rack_app_class.nil? && rack_app_class.respond_to?(:call) rack_app_class else Class.new(Rack::App) end klass.class_eval(&constructor) unless constructor.nil? return in_this_context(:__rack_app_class__){ klass } end |