Class: LedgerGen::Posting

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/ledger_gen/posting.rb

Instance Method Summary collapse

Constructor Details

#initializePosting

Returns a new instance of Posting.



8
9
10
11
# File 'lib/ledger_gen/posting.rb', line 8

def initialize
  @account = T.let('', String)
  @amount = T.let(nil, T.nilable(Numeric))
end

Instance Method Details

#account(account) ⇒ Object



14
15
16
# File 'lib/ledger_gen/posting.rb', line 14

def ()
  @account = 
end

#amount(amount) ⇒ Object



19
20
21
# File 'lib/ledger_gen/posting.rb', line 19

def amount(amount)
  @amount = amount
end

#amount_stringObject



29
30
31
32
33
34
35
# File 'lib/ledger_gen/posting.rb', line 29

def amount_string
  if @amount.nil?
    ''
  else
    sprintf('$%0.2f', @amount)
  end
end

#to_sObject



24
25
26
# File 'lib/ledger_gen/posting.rb', line 24

def to_s
  "#{@account}  #{amount_string}"
end