Class: Hoodie::Equalizer
Overview
Define equality, equivalence and inspection methods.
Defined Under Namespace
Modules: Methods
Instance Method Summary collapse
-
#<<(key) ⇒ Equalizer
private
Append a key and compile the equality methods.
-
#initialize(name, keys = []) ⇒ undefined
constructor
private
Initialize an Equalizer with the given keys.
Constructor Details
#initialize(name, keys = []) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize an Equalizer with the given keys.
Will use the keys with which it is initialized to define #cmp?, #hash, and #inspect
37 38 39 40 41 42 |
# File 'lib/hoodie/utils/equalizer.rb', line 37 def initialize(name, keys = []) @name = name.dup.freeze @keys = keys.dup define_methods include_comparison_methods end |
Instance Method Details
#<<(key) ⇒ Equalizer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Append a key and compile the equality methods.
49 50 51 52 |
# File 'lib/hoodie/utils/equalizer.rb', line 49 def <<(key) @keys << key self end |