Class: Dimensional::Enum::Attribute
- Inherits:
-
Object
- Object
- Dimensional::Enum::Attribute
- Defined in:
- lib/dimensional/enum/attribute.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #id ⇒ Object (also: #value)
-
#initialize(enum_attr_key, enum_attribute) ⇒ Attribute
constructor
A new instance of Attribute.
- #label ⇒ Object
- #name ⇒ Object
- #to_i ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(enum_attr_key, enum_attribute) ⇒ Attribute
Returns a new instance of Attribute.
5 6 7 8 |
# File 'lib/dimensional/enum/attribute.rb', line 5 def initialize( enum_attr_key, enum_attribute ) @enum_attr_key = enum_attr_key @enum_attribute = enum_attribute end |
Instance Method Details
#==(other) ⇒ Object
10 11 12 |
# File 'lib/dimensional/enum/attribute.rb', line 10 def ==( other ) to_s == other end |
#id ⇒ Object Also known as: value
14 15 16 17 18 |
# File 'lib/dimensional/enum/attribute.rb', line 14 def id @enum_attribute[label][:id] rescue nil end |
#label ⇒ Object
26 27 28 29 30 |
# File 'lib/dimensional/enum/attribute.rb', line 26 def label @enum_attr_key.to_sym rescue nil end |
#name ⇒ Object
20 21 22 23 24 |
# File 'lib/dimensional/enum/attribute.rb', line 20 def name @enum_attribute[label][:name] rescue nil end |
#to_i ⇒ Object
40 41 42 |
# File 'lib/dimensional/enum/attribute.rb', line 40 def to_i id.to_i end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/dimensional/enum/attribute.rb', line 32 def to_s label.to_s end |
#to_sym ⇒ Object
36 37 38 |
# File 'lib/dimensional/enum/attribute.rb', line 36 def to_sym label.to_sym end |