Class: Reloj::Params

Inherits:
Object
  • Object
show all
Defined in:
lib/reloj/core/params.rb

Defined Under Namespace

Classes: AttributeNotFoundError

Instance Method Summary collapse

Constructor Details

#initialize(req, route_params = {}) ⇒ Params

Returns a new instance of Params.



5
6
7
8
9
10
11
# File 'lib/reloj/core/params.rb', line 5

def initialize(req, route_params = {})
  @params = route_params
  if req.query_string
    @params.merge!(parse_www_encoded_form(req.query_string))
  end
  @params.merge!(parse_www_encoded_form(req.body)) if req.body
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
16
# File 'lib/reloj/core/params.rb', line 13

def [](key)
  key = key.to_s
  @params[key]
end

#to_sObject



18
19
20
# File 'lib/reloj/core/params.rb', line 18

def to_s
  @params.to_json.to_s
end