Class: Trackets::Params

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rack_env) ⇒ Params

Returns a new instance of Params.



6
7
8
# File 'lib/trackets/params.rb', line 6

def initialize(rack_env)
  @rack_env = rack_env
end

Instance Attribute Details

#rack_envObject (readonly)

Returns the value of attribute rack_env.



4
5
6
# File 'lib/trackets/params.rb', line 4

def rack_env
  @rack_env
end

Instance Method Details

#filteredObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/trackets/params.rb', line 18

def filtered
  hash.inject({}) do |ret, (key, value)|
    ret[key] = if value.kind_of?(Hash)
      self.class.new(value).filtered
    else
      Trackets.configuration.blacklisted_key?(key, rack_env) ? "[FILTERED]" : value
    end

    ret
  end
end

#hashObject



14
15
16
# File 'lib/trackets/params.rb', line 14

def hash
  @hash ||= request.params
end

#requestObject



10
11
12
# File 'lib/trackets/params.rb', line 10

def request
  @request ||= Rack::Request.new(rack_env)
end