Class: Billing::Modifier

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
BillItem
Defined in:
app/models/billing/modifier.rb

Class Method Summary collapse

Class Method Details

.wild_args(*args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/models/billing/modifier.rb', line 21

def wild_args(*args)
  case when args.blank? || args.first.kind_of?(Hash) then
    {}.merge(*args)
  when args.first.kind_of?(String) then
    d = args.shift
    if d.index('%')
      #TODO parse
    end
  else
    h = { fixed_value: args.shift.to_money }
    args.any? ? h.merge(*args) : h
  end
end