Class: Ruflet::IconData
- Inherits:
-
Object
- Object
- Ruflet::IconData
- Defined in:
- lib/ruflet_ui/ruflet/icon_data.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(value) ⇒ IconData
constructor
A new instance of IconData.
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ IconData
Returns a new instance of IconData.
14 15 16 |
# File 'lib/ruflet_ui/ruflet/icon_data.rb', line 14 def initialize(value) @value = normalize(value) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
12 13 14 |
# File 'lib/ruflet_ui/ruflet/icon_data.rb', line 12 def value @value end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ruflet_ui/ruflet/icon_data.rb', line 18 def ==(other) other_value = other.is_a?(IconData) ? other.value : self.class.new(other).value if value.is_a?(Integer) && other_value.is_a?(Integer) value == other_value elsif value.is_a?(String) && other_value.is_a?(String) value.casecmp?(other_value) else value == other_value end end |
#eql?(other) ⇒ Boolean
29 30 31 |
# File 'lib/ruflet_ui/ruflet/icon_data.rb', line 29 def eql?(other) self == other end |
#hash ⇒ Object
33 34 35 |
# File 'lib/ruflet_ui/ruflet/icon_data.rb', line 33 def hash value.is_a?(String) ? value.downcase.hash : value.hash end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/ruflet_ui/ruflet/icon_data.rb', line 37 def to_s value.to_s end |