Module: Joyent::Cloud::Pricing::Helpers

Included in:
Configuration, Formatter, Reserve
Defined in:
lib/pricing/helpers.rb

Instance Method Summary collapse

Instance Method Details

#currency_format(string) ⇒ Object

Returns string formatted with commas in the middle, such as “9,999,999”



11
12
13
14
# File 'lib/pricing/helpers.rb', line 11

def currency_format string
  while string.sub!(/(\d+)(\d\d\d)/, '\1,\2'); end
  string
end

#monthly_from_hourly(price) ⇒ Object



6
7
8
# File 'lib/pricing/helpers.rb', line 6

def monthly_from_hourly price
  price * HOURS_PER_MONTH
end