Module: ResourcesHelper

Defined in:
app/helpers/resources_helper.rb

Instance Method Summary collapse

Instance Method Details

#price_per_core(resource, raw: false) ⇒ Object


2
3
4
5
6
# File 'app/helpers/resources_helper.rb', line 2

def price_per_core(resource, raw: false)
  cores = resource.ma['cores'] == 'shared' ? 0.1 : resource.ma['cores']
  ppc = resource.price_per_month / BigDecimal.new(cores.to_s)
  raw ? ppc : format_price(ppc)
end

#price_per_gb_ram(resource, raw: false) ⇒ Object


8
9
10
11
# File 'app/helpers/resources_helper.rb', line 8

def price_per_gb_ram(resource, raw: false)
  ppgr = resource.price_per_month / BigDecimal.new(resource.ma['mem_gb'].to_s)
  raw ? ppgr : format_price(ppgr, precision: 2)
end