Sha256: b11e89328a4ccef2fbb3a7c826d540755c9baee729752d8ab3557b20fe7236a9
Contents?: true
Size: 546 Bytes
Versions: 30
Compression:
Stored size: 546 Bytes
Contents
module RR module WildcardMatchers class DuckType attr_accessor :required_methods def initialize(*required_methods) @required_methods = required_methods end def wildcard_match?(other) return true if self == other required_methods.each do |m| return false unless other.respond_to?(m) end return true end def ==(other) return false unless other.is_a?(self.class) self.required_methods == other.required_methods end end end end
Version data entries
30 entries across 30 versions & 1 rubygems