Class: Slick::Util::ParamsHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/slick/util/params_hash.rb

Instance Method Summary collapse

Constructor Details

#initializeParamsHash

Returns a new instance of ParamsHash.



4
5
6
# File 'lib/slick/util/params_hash.rb', line 4

def initialize
   super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/slick/util/params_hash.rb', line 30

def method_missing(name, *args, &block)
    if args.length == 0 && !block
        self[name]
    else
        super
    end
end

Instance Method Details

#[](key) ⇒ Object



12
13
14
# File 'lib/slick/util/params_hash.rb', line 12

def[](key)
    super(key.to_s)
end

#[]=(key, value) ⇒ Object



8
9
10
# File 'lib/slick/util/params_hash.rb', line 8

def []=(key, value)
    super(key.to_s, value)
end

#key?(name) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/slick/util/params_hash.rb', line 26

def key?(name)
    super(name.to_s)
end

#merge(hash) ⇒ Object



20
21
22
23
24
# File 'lib/slick/util/params_hash.rb', line 20

def merge(hash)
    out = clone
    out.merge!(hash)
    out
end

#merge!(hash) ⇒ Object



16
17
18
# File 'lib/slick/util/params_hash.rb', line 16

def merge!(hash)
    hash.each{|key, value| self[key] = value }
end