lib/map.rb in map-1.2.3 vs lib/map.rb in map-1.2.5
- old
+ new
@@ -1,7 +1,7 @@
class Map < Hash
- Version = '1.2.3' unless defined?(Version)
+ Version = '1.2.5' unless defined?(Version)
Load = Kernel.method(:load) unless defined?(Load)
class << Map
def version
Map::Version
@@ -95,24 +95,22 @@
initialize_from_array(args)
end
end
def initialize_from_hash(hash)
+ map = self
map.update(hash)
map.default = hash.default
end
def initialize_from_array(array)
+ map = self
Map.each_pair(array){|key, val| map[key] = val}
end
# support methods
#
- def map
- self
- end
-
def klass
self.class
end
def map_for(hash)
@@ -272,10 +270,10 @@
def delete_if
to_delete = []
keys.each{|key| to_delete.push(key) if yield(key)}
to_delete.each{|key| delete(key)}
- map
+ self
end
def replace(hash)
clear
update(hash)