Sha256: d2c206edcf90b31adc7f311f6f103ccc3f2d8e7156d44ff54e7a6e54dea44295

Contents?: true

Size: 477 Bytes

Versions: 13

Compression:

Stored size: 477 Bytes

Contents

module Rack::App::Test::SingletonMethods

  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

  def in_this_context(name, &block)
    let(name, &block)
  rescue NoMethodError
    define_method(name, &block)
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rack-app-5.10.1 lib/rack/app/test/singleton_methods.rb
rack-app-5.10.0 lib/rack/app/test/singleton_methods.rb
rack-app-5.9.0 lib/rack/app/test/singleton_methods.rb
rack-app-5.8.0 lib/rack/app/test/singleton_methods.rb
rack-app-5.7.0 lib/rack/app/test/singleton_methods.rb
rack-app-5.7.0.rc lib/rack/app/test/singleton_methods.rb
rack-app-5.6.0 lib/rack/app/test/singleton_methods.rb
rack-app-5.5.1 lib/rack/app/test/singleton_methods.rb
rack-app-5.4.0 lib/rack/app/test/singleton_methods.rb
rack-app-5.3.2 lib/rack/app/test/singleton_methods.rb
rack-app-5.3.1 lib/rack/app/test/singleton_methods.rb
rack-app-5.3.0 lib/rack/app/test/singleton_methods.rb
rack-app-5.2.0 lib/rack/app/test/singleton_methods.rb