Sha256: 98bb9b8e612f64be79318585cf7b20c4dedce2f16f2f1001d88f959f7b87367d

Contents?: true

Size: 502 Bytes

Versions: 46

Compression:

Stored size: 502 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)
    if respond_to?(:let)
      let(name, &block)
    else 
      define_method(name, &block)
    end 
  end

end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
rack-app-7.3.2 lib/rack/app/test/singleton_methods.rb
rack-app-7.3.1 lib/rack/app/test/singleton_methods.rb
rack-app-7.3.0 lib/rack/app/test/singleton_methods.rb
rack-app-7.2.2 lib/rack/app/test/singleton_methods.rb
rack-app-7.2.1 lib/rack/app/test/singleton_methods.rb
rack-app-7.2.0 lib/rack/app/test/singleton_methods.rb
rack-app-7.1.0 lib/rack/app/test/singleton_methods.rb
rack-app-7.0.0 lib/rack/app/test/singleton_methods.rb
rack-app-6.8.0 lib/rack/app/test/singleton_methods.rb
rack-app-6.7.1 lib/rack/app/test/singleton_methods.rb
rack-app-6.7.0 lib/rack/app/test/singleton_methods.rb
rack-app-6.6.0 lib/rack/app/test/singleton_methods.rb
rack-app-6.5.0 lib/rack/app/test/singleton_methods.rb
rack-app-6.4.1 lib/rack/app/test/singleton_methods.rb
rack-app-6.4.0 lib/rack/app/test/singleton_methods.rb
rack-app-6.3.3 lib/rack/app/test/singleton_methods.rb
rack-app-6.3.2 lib/rack/app/test/singleton_methods.rb
rack-app-6.3.1 lib/rack/app/test/singleton_methods.rb
rack-app-6.3.0 lib/rack/app/test/singleton_methods.rb
rack-app-6.2.0 lib/rack/app/test/singleton_methods.rb