Module: Interface::Helpers

Included in:
Interface
Defined in:
lib/interface/helpers.rb

Instance Method Summary collapse

Instance Method Details

#must_implement(*args) ⇒ Object

Errors raised here identify the class_name that is not implementing or is implemented with the wrong arity required by the Interface.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/interface/helpers.rb', line 7

def must_implement(*args)
  args.each do |method|
    if method.is_a? Hash
      method.each do |name, arity|
        next if valid_method?(name, arity)
        raise_interface_error(name, arity)
      end
    else
      next if valid_method?(method)
      raise_interface_error(method)
    end
  end
end