lib/triad.rb in triad-0.2.2 vs lib/triad.rb in triad-0.3.0
- old
+ new
@@ -1,17 +1,17 @@
require "triad/version"
-require 'thread_safe'
+require "concurrent/hash"
class Triad
include Enumerable
class InvalidAddition < StandardError; end
class ItemNotPresent < StandardError; end
# stored as {key => ['Descriptor', value]}
def initialize
- @storage = ThreadSafe::Hash.new
+ @storage = Concurrent::Hash.new
end
attr_reader :storage
private :storage
def keys(arg=:__no_argument_given__)
@@ -52,12 +52,12 @@
def update(key, descriptor, value)
storage[key] = [descriptor, value]
end
- def each
+ def each(&block)
storage.each do |key, (descriptor, value)|
- yield key, descriptor, value
+ block.call key, descriptor, value
end
end
private