Sha256: c60de5c02de00e3ea22fadd0bf93b32b312e2d946782174087b2923b70f480d7

Contents?: true

Size: 538 Bytes

Versions: 31

Compression:

Stored size: 538 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

31 entries across 31 versions & 2 rubygems

Version Path
rack-app-11.0.2 lib/rack/app/middlewares/params/definition.rb
rack-app-11.0.1 lib/rack/app/middlewares/params/definition.rb
rack-app-11.0.0 lib/rack/app/middlewares/params/definition.rb
rack-app-10.0.0 lib/rack/app/middlewares/params/definition.rb
rack-app-9.0.0 lib/rack/app/middlewares/params/definition.rb
rack-app-8.1.0 lib/rack/app/middlewares/params/definition.rb
rack-app-8.0.1 lib/rack/app/middlewares/params/definition.rb
rack-app-8.0.0 lib/rack/app/middlewares/params/definition.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/rack-app-7.7.0/lib/rack/app/middlewares/params/definition.rb
rack-app-7.7.0 lib/rack/app/middlewares/params/definition.rb
rack-app-7.6.5 lib/rack/app/middlewares/params/definition.rb
rack-app-7.6.4 lib/rack/app/middlewares/params/definition.rb
rack-app-7.6.3 lib/rack/app/middlewares/params/definition.rb
rack-app-7.6.2 lib/rack/app/middlewares/params/definition.rb
rack-app-7.6.1 lib/rack/app/middlewares/params/definition.rb
rack-app-7.6.0 lib/rack/app/middlewares/params/definition.rb
rack-app-7.5.2 lib/rack/app/middlewares/params/definition.rb
rack-app-7.5.1 lib/rack/app/middlewares/params/definition.rb
rack-app-7.5.0 lib/rack/app/middlewares/params/definition.rb
rack-app-7.4.0 lib/rack/app/middlewares/params/definition.rb