Class: Billing::Modifier
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Billing::Modifier
- Includes:
- BillItem
- Defined in:
- app/models/billing/modifier.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.wild_args(*args) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/billing/modifier.rb', line 29 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 |
Instance Method Details
#percentage ⇒ Object
14 15 16 |
# File 'app/models/billing/modifier.rb', line 14 def percentage percent_ratio.nil? ? "" : "#{(percent_ratio * 100).to_i}%" end |
#positive? ⇒ Boolean
18 19 20 |
# File 'app/models/billing/modifier.rb', line 18 def positive? percent_ratio.nil? ? fixed_value_cents > 0 : percent_ratio > 0 end |