Sha256: c822d356ea741c0e1eae457a87f72eb1a5fc0a50972572464d1afcdb5ab737cf

Contents?: true

Size: 533 Bytes

Versions: 33

Compression:

Stored size: 533 Bytes

Contents

class Rack::App::Middlewares::Params::Definition

  require "rack/app/middlewares/params/definition/options"

  def initialize(&descriptor)
    @required = {}
    @optional = {}
    instance_exec(&descriptor)
  end

  def required(params_key,options)
    @required[params_key.to_s]= self.class::Options.new(options).formatted
  end

  def optional(params_key,options)
    @optional[params_key.to_s]= self.class::Options.new(options).formatted
  end

  def to_descriptor
    {:required => @required, :optional => @optional}
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
rack-app-5.7.0.rc lib/rack/app/middlewares/params/definition.rb
rack-app-5.6.0 lib/rack/app/middlewares/params/definition.rb
rack-app-5.5.1 lib/rack/app/middlewares/params/definition.rb
rack-app-5.4.0 lib/rack/app/middlewares/params/definition.rb
rack-app-5.3.2 lib/rack/app/middlewares/params/definition.rb
rack-app-5.3.1 lib/rack/app/middlewares/params/definition.rb
rack-app-5.3.0 lib/rack/app/middlewares/params/definition.rb
rack-app-5.2.0 lib/rack/app/middlewares/params/definition.rb
rack-app-5.1.0 lib/rack/app/middlewares/params/definition.rb
rack-app-5.0.0 lib/rack/app/middlewares/params/definition.rb
rack-app-5.0.0.rc2 lib/rack/app/middlewares/params/definition.rb
rack-app-5.0.0.rc1 lib/rack/app/middlewares/params/definition.rb
rack-app-4.0.1 lib/rack/app/middlewares/params/definition.rb