Class: Overloadable::Signature

Inherits:
Array
  • Object
show all
Defined in:
lib/platypus/overload.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object


87
88
89
90
91
92
93
94
95
# File 'lib/platypus/overload.rb', line 87

def <=>(other)
  cmp = (size <=> other.size)
  return cmp if cmp && cmp != 0
  size.times do |i|
    cmp = (self[i] <=> other[i])
    return cmp if cmp && cmp != 0
  end
  0
end

#keyObject


73
74
75
# File 'lib/platypus/overload.rb', line 73

def key
  hash #Marshal.dump(self)
end

#match?(args) ⇒ Boolean


78
79
80
81
82
83
84
# File 'lib/platypus/overload.rb', line 78

def match?(args)
  return false unless size == args.size
  size.times do |i|
    return false unless self[i] === args[i]
  end
  true
end