Class: Dorsale::ExpenseGun::Expense::Copy
- Defined in:
- app/services/dorsale/expense_gun/expense/copy.rb
Instance Attribute Summary collapse
-
#copy ⇒ Object
Returns the value of attribute copy.
-
#expense ⇒ Object
Returns the value of attribute expense.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(expense) ⇒ Copy
constructor
A new instance of Copy.
Methods inherited from Service
Constructor Details
#initialize(expense) ⇒ Copy
Returns a new instance of Copy.
4 5 6 |
# File 'app/services/dorsale/expense_gun/expense/copy.rb', line 4 def initialize(expense) @expense = expense end |
Instance Attribute Details
#copy ⇒ Object
Returns the value of attribute copy.
2 3 4 |
# File 'app/services/dorsale/expense_gun/expense/copy.rb', line 2 def copy @copy end |
#expense ⇒ Object
Returns the value of attribute expense.
2 3 4 |
# File 'app/services/dorsale/expense_gun/expense/copy.rb', line 2 def expense @expense end |
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/dorsale/expense_gun/expense/copy.rb', line 8 def call @copy = expense.dup @copy.user = nil @copy.date = nil @copy.state = "new" @copy.created_at = nil @copy.updated_at = nil @expense.expense_lines.each do |line| line = line.dup line.date = nil line.created_at = nil line.updated_at = nil @copy.expense_lines << line end @copy end |