class Blix::Rest::StringHash
indifferent hash for symbols or string keys. stores keys as a string
Public Class Methods
create(params)
click to toggle source
create with conversion
# File lib/blix/rest/string_hash.rb, line 37 def self.create(params) h = new h.merge(params) h end
new(*params)
click to toggle source
initialize without conversion. params must be in string key format.
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 31 def initialize(*params) super() parent_merge!(*params) unless params.empty? end
Public Instance Methods
[](k)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 43 def [](k) super(k.to_s) end
[]=(k, v)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 87 def []=(k, v) super(k.to_s, v) end
delete(k)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 95 def delete(k) super(k.to_s) end
get(k, default = nil)
click to toggle source
# File lib/blix/rest/string_hash.rb, line 47 def get(k, default = nil) if key?(k.to_s) self[k] else default end end
has_key?(key)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 67 def has_key?(key) super(key.to_s) end
include?(k)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 91 def include?(k) super(k.to_s) end
key(key)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 79 def key(key) super(key.to_s) end
key?(key)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 83 def key?(key) super(key.to_s) end
member?(key)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 71 def member?(key) super(key.to_s) end
merge(*params)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 55 def merge(*params) super(* params.map { |h| h.transform_keys(&:to_s) }) end
merge!(*params)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 59 def merge!(*params) super(* params.map { |h| h.transform_keys(&:to_s) }) end
Also aliased as: parent_merge!
replace(h)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 63 def replace(h) super(h.transform_keys(&:to_s)) end
store(key, value)
click to toggle source
Calls superclass method
# File lib/blix/rest/string_hash.rb, line 75 def store(key, value) super(key.to_s, value) end