Module: HashBrowns::DisplayHelpers

Defined in:
lib/hashbrowns/helpers/display_helpers.rb

Instance Method Summary collapse

Instance Method Details

#display_name(name, table) ⇒ Object



19
20
21
22
23
24
# File 'lib/hashbrowns/helpers/display_helpers.rb', line 19

def display_name(name, table)
  names = HashBrowns.conf.pretty_names[name]
  return name unless names
  return names["all"] if names.has_key?("all")
  return names[table] ? names[table] : name
end

#importantize(key, value) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/hashbrowns/helpers/display_helpers.rb', line 8

def importantize(key, value)
  value = value.downcase if HashBrowns.conf.ignore_important_case && value.kind_of?(String)
  #puts "k: #{key}, v: #{value}"
  return "nil key" if key.nil?
  return "nil value" if value.nil?
  return "#{key} not important" unless HashBrowns.conf.important.has_key?(key)
  return "#{HashBrowns.conf.important[key].call(value)}" if HashBrowns.conf.important[key].kind_of?(Proc)
  return "#{value} not important for #{key}" unless HashBrowns.conf.important[key].has_key?(value)
  return "#{HashBrowns.conf.important[key][value]}"
end

#table_stylesObject



4
5
6
# File 'lib/hashbrowns/helpers/display_helpers.rb', line 4

def table_styles
  return HashBrowns.conf.table_styles.to_a.join(" ")
end