class LedgerGen::Posting

Public Class Methods

new() click to toggle source
# File lib/ledger_gen/posting.rb, line 8
def initialize
  @account = T.let('', String)
  @amount = T.let(nil, T.nilable(Numeric))
end

Public Instance Methods

account(account) click to toggle source
# File lib/ledger_gen/posting.rb, line 14
def account(account)
  @account = account
end
amount(amount) click to toggle source
# File lib/ledger_gen/posting.rb, line 19
def amount(amount)
  @amount = amount
end
amount_string() click to toggle source
# File lib/ledger_gen/posting.rb, line 29
def amount_string
  if @amount.nil?
    ''
  else
    sprintf('$%0.2f', @amount)
  end
end
to_s() click to toggle source
# File lib/ledger_gen/posting.rb, line 24
def to_s
  "#{@account}  #{amount_string}"
end