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



4
5
6
7
# File 'lib/bitflyer/cli/ext/string.rb', line 4

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

#split_by_commaObject



9
10
11
# File 'lib/bitflyer/cli/ext/string.rb', line 9

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