module Stronger::TypeChecking

Public Instance Methods

implements?(interface) click to toggle source
# File lib/stronger/type_checking.rb, line 16
def implements?(interface)
  interface.methods.all?{|m| respond_to?(m) }
end
is_strong?(type) click to toggle source
# File lib/stronger/type_checking.rb, line 4
def is_strong?(type)
  if type.is_a?(Interface)
    implements?(type)
  elsif type.is_a?(Class) or type.is_a?(Module)
    is_a?(type)
  else
    raise ArgumentError, "Don't know how to compare type of "\
      "#{self} against #{type}.  Try using a "\
      "Stronger::Interface, Class or Module"
  end
end