class Capwatch::Console::Formatter
Public Class Methods
condition_color(value)
click to toggle source
# File lib/capwatch/console.rb, line 97 def condition_color(value) percent_value = value.to_f if percent_value > 1 value.green elsif percent_value < 0 value.red else value.green end end
format_btc(value)
click to toggle source
# File lib/capwatch/console.rb, line 85 def format_btc(value) format("฿%.2f", value) end
format_eth(value)
click to toggle source
# File lib/capwatch/console.rb, line 89 def format_eth(value) format("Ξ%.2f", value) end
format_percent(value)
click to toggle source
# File lib/capwatch/console.rb, line 93 def format_percent(value) format("%.2f%", value.to_f) end
format_usd(n)
click to toggle source
# File lib/capwatch/console.rb, line 81 def format_usd(n) "$" + n.to_f.round(2).to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse end