./lib/hash_wia/module.rb in hash_wia-0.8.2 vs ./lib/hash_wia/module.rb in hash_wia-0.8.3
- old
+ new
@@ -26,20 +26,13 @@
end
end
def []= key, value
key = key.to_s unless key.class == Symbol
-
super key, value
end
- def __val key
- data = self[key.to_s]
- data = self[to_s] if data.nil?
- data
- end
-
def delete key
data = super(key)
skey = key.to_s
data = super(skey) if data.nil?
data = super(skey.to_sym) if data.nil? && key.class != Symbol
@@ -52,10 +45,10 @@
end
# key is common id direct access
# allow direct get or fuction the same if name given
def key name = nil
- name.nil? ? self[:key] : self[name.to_s]
+ self[name.nil? ? :key : name]
end
# true clone of the hash with 0 references to the old one
def clone
Marshal.load(Marshal.dump(self))