Module: HashBrowns::OverviewHelpers
- Defined in:
- lib/hashbrowns/helpers/overview_helpers.rb
Instance Method Summary collapse
Instance Method Details
#field_parser(k, v, path) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/hashbrowns/helpers/overview_helpers.rb', line 12 def field_parser(k, v, path) k, path = k.to_s, path.map{|p| p.to_s} return "#{k} had nil value at #{path.inspect}" if v.nil? return v.map{|i| [display_name(i, path.last), path + [i]] } if k == "values" return v.map{|ki, vi| field_parser(ki, vi, path + [k]) }.inject(:+) end |
#overview_fields(type) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/hashbrowns/helpers/overview_helpers.rb', line 4 def overview_fields(type) type = type.to_s fields = HashBrowns.conf.key_fields[type] return [] unless fields #puts "calling field parser now" return field_parser(type, fields, []) end |