Class: EacRubyUtils::Listable::Value
- Defined in:
- lib/eac_ruby_utils/listable/value.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.
8 9 10 11 12 |
# File 'lib/eac_ruby_utils/listable/value.rb', line 8 def initialize(list, value, key) @list = list @value = value @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/eac_ruby_utils/listable/value.rb', line 6 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/eac_ruby_utils/listable/value.rb', line 6 def value @value end |
Instance Method Details
#constant_name ⇒ Object
18 19 20 21 |
# File 'lib/eac_ruby_utils/listable/value.rb', line 18 def constant_name "#{@list.item}_#{@key}".gsub(/[^a-z0-9_]/, '_').gsub(/_+/, '_') .gsub(/(?:\A_|_\z)/, '').upcase end |
#description ⇒ Object
27 28 29 |
# File 'lib/eac_ruby_utils/listable/value.rb', line 27 def description translate('description') end |
#label ⇒ Object
23 24 25 |
# File 'lib/eac_ruby_utils/listable/value.rb', line 23 def label translate('label') end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/eac_ruby_utils/listable/value.rb', line 14 def to_s "I: #{@list.item}, V: #{@value}, K: #{@key}" end |