Sha256: 43a4d8f733cfffdfe979333dadb0a11a667d19f0c4315d0d4aeebea033176920

Contents?: true

Size: 336 Bytes

Versions: 4

Compression:

Stored size: 336 Bytes

Contents

module LedgerGen
  class Posting
    def account(account)
      @account = account
    end

    def amount(amount)
      @amount = amount
    end

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ledger_gen-0.2.0 lib/ledger_gen/posting.rb
ledger_gen-0.1.2 lib/ledger_gen/posting.rb
ledger_gen-0.1.1 lib/ledger_gen/posting.rb
ledger_gen-0.1.0 lib/ledger_gen/posting.rb