Sha256: f9be7e01832d6292db1ad516e7589ef2e33f354ddaacb2f8389fbb5682c288e9

Contents?: true

Size: 547 Bytes

Versions: 10

Compression:

Stored size: 547 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      = "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
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dorsale-3.3.0 app/services/dorsale/expense_gun/expense/copy.rb
dorsale-3.2.0 app/services/dorsale/expense_gun/expense/copy.rb
dorsale-3.1.7 app/services/dorsale/expense_gun/expense/copy.rb
dorsale-3.1.6 app/services/dorsale/expense_gun/expense/copy.rb
dorsale-3.1.5 app/services/dorsale/expense_gun/expense/copy.rb
dorsale-3.1.4 app/services/dorsale/expense_gun/expense/copy.rb
dorsale-3.1.3 app/services/dorsale/expense_gun/expense/copy.rb
dorsale-3.1.2 app/services/dorsale/expense_gun/expense/copy.rb
dorsale-3.1.1 app/services/dorsale/expense_gun/expense/copy.rb
dorsale-3.1.0 app/services/dorsale/expense_gun/expense/copy.rb