Class: EnumerableConstant::Tupple
- Inherits:
-
Object
- Object
- EnumerableConstant::Tupple
- Includes:
- Comparable
- Defined in:
- lib/spree_core/enumerable_constants.rb
Instance Attribute Summary collapse
-
#display_name ⇒ Object
Returns the value of attribute display_name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #id ⇒ Object
-
#initialize(name, value = nil, display_name = nil) ⇒ Tupple
constructor
A new instance of Tupple.
- #title ⇒ Object
- #title_translated ⇒ Object
Constructor Details
#initialize(name, value = nil, display_name = nil) ⇒ Tupple
Returns a new instance of Tupple.
19 20 21 22 23 |
# File 'lib/spree_core/enumerable_constants.rb', line 19 def initialize(name, value=nil, display_name=nil) @name = name @value = value @display_name = display_name end |
Instance Attribute Details
#display_name ⇒ Object
Returns the value of attribute display_name.
17 18 19 |
# File 'lib/spree_core/enumerable_constants.rb', line 17 def display_name @display_name end |
#name ⇒ Object
Returns the value of attribute name.
17 18 19 |
# File 'lib/spree_core/enumerable_constants.rb', line 17 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
17 18 19 |
# File 'lib/spree_core/enumerable_constants.rb', line 17 def value @value end |
Instance Method Details
#<=>(other) ⇒ Object
25 26 27 |
# File 'lib/spree_core/enumerable_constants.rb', line 25 def <=> other self.display_name <=> other.display_name end |
#id ⇒ Object
41 42 43 |
# File 'lib/spree_core/enumerable_constants.rb', line 41 def id self.value end |
#title ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/spree_core/enumerable_constants.rb', line 33 def title if @display_name self.display_name else self.name.titleize.strip end end |
#title_translated ⇒ Object
29 30 31 |
# File 'lib/spree_core/enumerable_constants.rb', line 29 def title_translated t("order_status_#{self.name.downcase}") end |