class MudratProjector::PercentageTransactionEntry

Attributes

other_account_id[R]

Public Class Methods

new(params = {}) click to toggle source
Calls superclass method MudratProjector::TransactionEntry::new
# File lib/mudrat_projector/transaction_entry.rb, line 109
def initialize params = {}
  @other_account_id = params.fetch :other_account_id
  super params
end

Public Instance Methods

calculate_amount(chart_of_accounts) click to toggle source
# File lib/mudrat_projector/transaction_entry.rb, line 114
def calculate_amount chart_of_accounts
  @amount = scalar * chart_of_accounts.fetch(other_account_id).balance
end
inspect() click to toggle source
# File lib/mudrat_projector/transaction_entry.rb, line 118
def inspect
  "#<#{self.class}: percent=#{fmt(scalar * 100)}%, account_id=#{account_id.inspect} type=#{@credit_or_debit.inspect}, other_account_id=#{other_account_id.inspect}>"
end
serialize() click to toggle source
# File lib/mudrat_projector/transaction_entry.rb, line 122
def serialize
  super.tap do |hash| hash[:other_account_id] = other_account_id; end
end