Class: IdentityMind::Params
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- IdentityMind::Params
show all
- Defined in:
- lib/identity_mind/params.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(hash = nil) ⇒ Params
Returns a new instance of Params.
9
10
11
12
13
14
15
16
|
# File 'lib/identity_mind/params.rb', line 9
def initialize(hash = nil)
@table = {}
return unless hash
hash.each_pair do |k, v|
@table[k.to_sym] = parse_param(v)
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mid, *args) ⇒ Object
26
27
28
29
|
# File 'lib/identity_mind/params.rb', line 26
def method_missing(mid, *args)
args[0] = parse_param(args[0]) if args[0]
super
end
|
Class Method Details
.[](hash) ⇒ Object
3
4
5
6
7
|
# File 'lib/identity_mind/params.rb', line 3
def self.[](hash)
return hash if hash.is_a?(self)
new(hash)
end
|
Instance Method Details
#[]=(name, value) ⇒ Object
18
19
20
|
# File 'lib/identity_mind/params.rb', line 18
def []=(name, value)
super(name, parse_param(value))
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
31
32
33
|
# File 'lib/identity_mind/params.rb', line 31
def respond_to_missing?(method_name, include_private = false)
super
end
|
#to_json(opts = {}) ⇒ Object
22
23
24
|
# File 'lib/identity_mind/params.rb', line 22
def to_json(opts = {})
@table.to_json(opts)
end
|