Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/bitflyer/cli/ext/string.rb

Instance Method Summary collapse

Instance Method Details

#color_with_number(number) ⇒ Object



6
7
8
9
# File 'lib/bitflyer/cli/ext/string.rb', line 6

def color_with_number(number)
  sign = number >= 0.0 ? '+' : ''
  sign + colorize(number >= 0.0 ? :green : :red)
end

#split_by_commaObject



11
12
13
# File 'lib/bitflyer/cli/ext/string.rb', line 11

def split_by_comma
  reverse.gsub(/(\d{3})(?=\d)/, '\1,').reverse
end