Sha256: 589895467fede377d64d33491288c0674c57685a6b83465aa816c77e5ea3fc33

Contents?: true

Size: 549 Bytes

Versions: 42

Compression:

Stored size: 549 Bytes

Contents

class Dorsale::ExpenseGun::Expense::Copy < ::Dorsale::Service
  attr_accessor :expense, :copy

  def initialize(expense)
    @expense = expense
  end

  def call
    @copy = expense.dup

    @copy.user       = nil
    @copy.date       = nil
    @copy.state      = "draft"
    @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
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
dorsale-3.5.0 app/services/dorsale/expense_gun/expense/copy.rb
dorsale-3.4.0 app/services/dorsale/expense_gun/expense/copy.rb