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 the method required by the Interface.



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

def must_implement(*args)
  args.each do |method_name|
    next if respond_to? method_name
    raise Interface::Error::NotImplementedError.new(
            class_name: self.class.name,
            method_name: method_name,
            interface_name: self.class.ancestors.first
          )
  end
end