Class: EacRubyUtils::Listable::Value

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_ruby_utils/listable/value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list, value, key) ⇒ Value

Returns a new instance of Value.


10
11
12
13
14
# File 'lib/eac_ruby_utils/listable/value.rb', line 10

def initialize(list, value, key)
  @list = list
  @value = value
  @key = key
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key


8
9
10
# File 'lib/eac_ruby_utils/listable/value.rb', line 8

def key
  @key
end

#valueObject (readonly)

Returns the value of attribute value


8
9
10
# File 'lib/eac_ruby_utils/listable/value.rb', line 8

def value
  @value
end

Instance Method Details

#constant_nameObject


20
21
22
# File 'lib/eac_ruby_utils/listable/value.rb', line 20

def constant_name
  ::EacRubyUtils::Inflector.variableize("#{@list.item}_#{@key}").upcase
end

#descriptionObject


28
29
30
# File 'lib/eac_ruby_utils/listable/value.rb', line 28

def description
  translate('description')
end

#labelObject


24
25
26
# File 'lib/eac_ruby_utils/listable/value.rb', line 24

def label
  translate('label')
end

#to_sObject


16
17
18
# File 'lib/eac_ruby_utils/listable/value.rb', line 16

def to_s
  "I: #{@list.item}, V: #{@value}, K: #{@key}"
end