Class: ConvenientService::Support::UniqueValue
- Inherits:
-
Object
- Object
- ConvenientService::Support::UniqueValue
- Defined in:
- lib/convenient_service/support/unique_value.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
- #==(other) ⇒ Boolean?
- #===(other) ⇒ Boolean?
- #eql?(other) ⇒ Boolean?
- #hash ⇒ Integer
- #initialize(label = default_label) ⇒ void constructor
- #inspect ⇒ String
Constructor Details
#initialize(label = default_label) ⇒ void
21 22 23 |
# File 'lib/convenient_service/support/unique_value.rb', line 21 def initialize(label = default_label) @label = label end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
15 16 17 |
# File 'lib/convenient_service/support/unique_value.rb', line 15 def label @label end |
Instance Method Details
#==(other) ⇒ Boolean?
33 34 35 36 37 |
# File 'lib/convenient_service/support/unique_value.rb', line 33 def ==(other) return unless other.instance_of?(self.class) equal?(other) end |
#===(other) ⇒ Boolean?
43 44 45 |
# File 'lib/convenient_service/support/unique_value.rb', line 43 def ===(other) self == other end |
#eql?(other) ⇒ Boolean?
57 58 59 60 61 |
# File 'lib/convenient_service/support/unique_value.rb', line 57 def eql?(other) return unless other.instance_of?(self.class) object_id == other.object_id end |
#hash ⇒ Integer
70 71 72 |
# File 'lib/convenient_service/support/unique_value.rb', line 70 def hash [self.class, label].hash end |
#inspect ⇒ String
77 78 79 80 81 82 |
# File 'lib/convenient_service/support/unique_value.rb', line 77 def inspect return default_label if label.nil? return default_label if label.empty? label end |