Method: Phamilie#initialize
- Defined in:
- lib/phamilie.rb
#initialize(cache = {}) ⇒ Phamilie
Returns a new instance of Phamilie.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/phamilie.rb', line 2 def initialize(cache = {}) {:[] => 1, :[]= => 2}.each do |method, desired_arity| unless cache.respond_to?(method) raise ArgumentError.new("#{cache} does not respond to #{method}") end arity = cache.method(method).arity unless arity == desired_arity raise ArgumentError.new("#{cache} method #{method} arity should be #{desired_arity} instead of #{arity}") end end @cache = cache end |