lib/surrogate/hatchling.rb in surrogate-0.5.5 vs lib/surrogate/hatchling.rb in surrogate-0.6.0

- old
+ new

@@ -18,10 +18,11 @@ def invoke_method(method_name, args, &block) invocation = Invocation.new(args, &block) invoked_methods[method_name] << invocation return get_default method_name, invocation, &block unless has_ivar? method_name + interfaces_must_match! method_name, args Value.factory(get_ivar method_name).value(method_name) end def prepare_method(method_name, args, &block) set_ivar method_name, Value.factory(*args, &block) @@ -36,9 +37,13 @@ def invoked_methods @invoked_methods ||= Hash.new do |hash, method_name| must_know method_name hash[method_name] = [] end + end + + def interfaces_must_match!(method_name, args) + api_methods[method_name].must_match! args end def get_default(method_name, invocation) api_methods[method_name].default instance, invocation do raise UnpreparedMethodError, "#{method_name} has been invoked without being told how to behave"