Class: Eboshi::Budget
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Eboshi::Budget
- Defined in:
- app/models/eboshi/budget.rb
Instance Attribute Summary collapse
-
#unbilled_invoice ⇒ Object
Returns the value of attribute unbilled_invoice.
Instance Method Summary collapse
Instance Attribute Details
#unbilled_invoice ⇒ Object
Returns the value of attribute unbilled_invoice.
10 11 12 |
# File 'app/models/eboshi/budget.rb', line 10 def unbilled_invoice @unbilled_invoice end |
Instance Method Details
#name_and_total ⇒ Object
20 21 22 |
# File 'app/models/eboshi/budget.rb', line 20 def name_and_total [name, total.to_s].join(" - $") end |
#over? ⇒ Boolean
28 29 30 |
# File 'app/models/eboshi/budget.rb', line 28 def over? used > total end |
#remaining ⇒ Object
16 17 18 |
# File 'app/models/eboshi/budget.rb', line 16 def remaining total - used end |
#under? ⇒ Boolean
24 25 26 |
# File 'app/models/eboshi/budget.rb', line 24 def under? used < total end |
#used ⇒ Object
12 13 14 |
# File 'app/models/eboshi/budget.rb', line 12 def used invoices.to_a.sum(&:total) + unbilled_invoice.try(:total).to_f end |