==(other)
click to toggle source
def ==(other)
other.is_a?(self.class) &&
other.required_methods == self.required_methods
end
eql?(other)
click to toggle source
inspect()
click to toggle source
def inspect
formatted_required_methods =
required_methods.map { |method_name| method_name.inspect }.join(', ')
"duck_type(#{formatted_required_methods})"
end
wildcard_match?(other)
click to toggle source
def wildcard_match?(other)
self == other ||
required_methods.all? {|m| other.respond_to?(m) }
end