module Stronger::TypeChecking::Implementers

Public Instance Methods

<(type) click to toggle source
Calls superclass method
# File lib/stronger/type_checking.rb, line 22
def <(type)
  if type.is_a?(Interface)
    instance_implements?(type)
  else
    super(type)
  end
end
>(type) click to toggle source
# File lib/stronger/type_checking.rb, line 30
def >(type)
  !(self <= type)
end
implement(interface) click to toggle source
# File lib/stronger/type_checking.rb, line 38
def implement(interface)
  interface.methods.each do |name|
    define_method(name) do
      raise NotImplementedError, "#{self.class} should implement #{name}!"
    end
  end
end
instance_implements?(interface) click to toggle source
# File lib/stronger/type_checking.rb, line 34
def instance_implements?(interface)
  (interface.methods - instance_methods).empty?
end