Class: DuckPuncher::UniqueDuck
- Defined in:
- lib/duck_puncher/unique_duck.rb
Instance Attribute Summary collapse
-
#punch_options ⇒ Object
Returns the value of attribute punch_options.
Attributes inherited from Duck
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Sorting.
-
#eql?(other) ⇒ Boolean
Required to play nice in a Set.
- #hash ⇒ Object
Methods inherited from Duck
Constructor Details
This class inherits a constructor from DuckPuncher::Duck
Instance Attribute Details
#punch_options ⇒ Object
Returns the value of attribute punch_options.
3 4 5 |
# File 'lib/duck_puncher/unique_duck.rb', line 3 def @punch_options end |
Instance Method Details
#<=>(other) ⇒ Object
Sorting
21 22 23 |
# File 'lib/duck_puncher/unique_duck.rb', line 21 def <=>(other) target <=> other.target end |
#eql?(other) ⇒ Boolean
Required to play nice in a Set
9 10 11 |
# File 'lib/duck_puncher/unique_duck.rb', line 9 def eql?(other) "#{target}-#{mod}" == "#{other.target}-#{other.mod}" end |
#hash ⇒ Object
13 14 15 |
# File 'lib/duck_puncher/unique_duck.rb', line 13 def hash target.to_s.hash + mod.to_s.hash + .to_s.hash end |