Class: ConvenientService::Support::Value
- Inherits:
-
Object
- Object
- ConvenientService::Support::Value
- Defined in:
- lib/convenient_service/support/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
16 17 18 |
# File 'lib/convenient_service/support/value.rb', line 16 def initialize(label = default_label) @label = label end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
10 11 12 |
# File 'lib/convenient_service/support/value.rb', line 10 def label @label end |
Instance Method Details
#==(other) ⇒ Boolean?
24 25 26 27 28 |
# File 'lib/convenient_service/support/value.rb', line 24 def ==(other) return unless other.instance_of?(self.class) label == other.label end |
#===(other) ⇒ Boolean?
34 35 36 |
# File 'lib/convenient_service/support/value.rb', line 34 def ===(other) self == other end |
#eql?(other) ⇒ Boolean?
42 43 44 45 46 |
# File 'lib/convenient_service/support/value.rb', line 42 def eql?(other) return unless other.instance_of?(self.class) hash == other.hash end |
#hash ⇒ Integer
54 55 56 |
# File 'lib/convenient_service/support/value.rb', line 54 def hash label.hash end |
#inspect ⇒ String
61 62 63 64 65 66 |
# File 'lib/convenient_service/support/value.rb', line 61 def inspect return default_label if label.nil? return default_label if label.empty? label end |