Class: Eac::Listable::Value
- Inherits:
-
Object
- Object
- Eac::Listable::Value
- Defined in:
- lib/eac/listable.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #constant_name ⇒ Object
- #description ⇒ Object
-
#initialize(list, value, key) ⇒ Value
constructor
A new instance of Value.
- #label ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(list, value, key) ⇒ Value
Returns a new instance of Value.
165 166 167 168 169 |
# File 'lib/eac/listable.rb', line 165 def initialize(list, value, key) @list = list @value = value @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
163 164 165 |
# File 'lib/eac/listable.rb', line 163 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
163 164 165 |
# File 'lib/eac/listable.rb', line 163 def value @value end |
Instance Method Details
#constant_name ⇒ Object
175 176 177 178 |
# File 'lib/eac/listable.rb', line 175 def constant_name "#{@list.item}_#{@key}".gsub(/[^a-z0-9_]/, '_').gsub(/_+/, '_') .gsub(/(?:\A_|_\z)/, '').upcase end |
#description ⇒ Object
184 185 186 |
# File 'lib/eac/listable.rb', line 184 def description translate('description') end |
#label ⇒ Object
180 181 182 |
# File 'lib/eac/listable.rb', line 180 def label translate('label') end |
#to_s ⇒ Object
171 172 173 |
# File 'lib/eac/listable.rb', line 171 def to_s "I: #{@list.item}, V: #{@value}, K: #{@key}" end |