module Formotion::RowType::ItemsMapper
Public Instance Methods
item_names()
click to toggle source
# File lib/formotion/row_type/items_mapper.rb, line 14 def item_names self.items.map { |name, value| name } end
item_names_hash()
click to toggle source
# File lib/formotion/row_type/items_mapper.rb, line 18 def item_names_hash hash = {} self.items.each do |name, value| hash[name] = value end hash end
items()
click to toggle source
# File lib/formotion/row_type/items_mapper.rb, line 4 def items if !row.items [] elsif row.items[0].is_a?(Enumerable) row.items else row.items.map {|i| [i, i]} end end
name_for_value(value)
click to toggle source
# File lib/formotion/row_type/items_mapper.rb, line 38 def name_for_value(value) item_names_hash.invert[value].to_s end
name_index_of_value(value)
click to toggle source
# File lib/formotion/row_type/items_mapper.rb, line 26 def name_index_of_value(value) item_names.index(item_names_hash.invert[value]) end
value_for_name(name)
click to toggle source
# File lib/formotion/row_type/items_mapper.rb, line 34 def value_for_name(name) item_names_hash[name] end
value_for_name_index(index)
click to toggle source
# File lib/formotion/row_type/items_mapper.rb, line 30 def value_for_name_index(index) item_names_hash[item_names[index]] end