lib/flipper/registry.rb in flipper-0.10.2 vs lib/flipper/registry.rb in flipper-0.11.0.beta1
- old
+ new
@@ -32,32 +32,30 @@
end
def add(key, value)
key = key.to_sym
- @mutex.synchronize {
+ @mutex.synchronize do
if @source[key]
raise DuplicateKey, "#{key} is already registered"
else
@source[key] = value
end
- }
+ end
end
def get(key)
key = key.to_sym
- @mutex.synchronize {
- @source.fetch(key) {
- raise KeyNotFound.new(key)
- }
- }
+ @mutex.synchronize do
+ @source[key]
+ end
end
def key?(key)
key = key.to_sym
- @mutex.synchronize {
- @source.has_key?(key)
- }
+ @mutex.synchronize do
+ @source.key?(key)
+ end
end
def each(&block)
@mutex.synchronize { @source.dup }.each(&block)
end