lib/mixed_gauge/config.rb in mixed_gauge-1.2.0.beta2 vs lib/mixed_gauge/config.rb in mixed_gauge-1.2.0
- old
+ new
@@ -1,10 +1,11 @@
require 'zlib'
module MixedGauge
+ # Holding global configuration
class Config
- DEFAULT_HASH_FUNCTION = -> (key) { Zlib.crc32(key) }
+ DEFAULT_HASH_FUNCTION = ->(key) { Zlib.crc32(key) }
attr_reader :hash_proc, :cluster_configs
def initialize
@cluster_configs = {}
@@ -32,10 +33,10 @@
# Register arbitrary hash function. Hash function must be a proc and
# must return integer.
# See README.md for example.
def register_hash_function(&block)
raise ArgumentError if block.arity != 1
- raise ArgumentError unless block.call('test value').is_a? Integer
+ raise ArgumentError unless yield('test value').is_a? Integer
@hash_proc = block
end
end
end