Cache#each -> AVCH#each_keys

This commit is contained in:
Denis Knauf 2010-03-30 11:43:59 +02:00
parent 694d2a22fa
commit 3fa3ac495d

View file

@ -46,9 +46,10 @@ class LogAn::Cache
end end
include Enumerable include Enumerable
def each def each *paras
return Enumerator.new self, :each unless block_given? return Enumerator.new self, :each unless block_given?
(@source.keys + @data.keys).each do |key| flush! if @type&2 == 2
@source.each_keys( *paras) do |key|
yield key, self[key] yield key, self[key]
end end
self self
@ -74,8 +75,16 @@ class LogAn::AutoValueConvertHash
end end
def each *paras def each *paras
return Enumerator.new self, :each unless block_given?
@each.call *paras do |k, v| @each.call *paras do |k, v|
yield k, @decode.call( v) yield k, @decode.call( v)
end end
end end
def each_keys *paras
return Enumerator.new self, :each_keys unless block_given?
@each.call *paras do |k, v|
yield k
end
end
end end