Class: Ledger::Journal
- Inherits:
-
Object
- Object
- Ledger::Journal
- Defined in:
- lib/libledger/journal.rb
Overview
Declaration for list of entries
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Journal
constructor
A new instance of Journal.
- #to_s ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Journal
Returns a new instance of Journal.
7 8 9 |
# File 'lib/libledger/journal.rb', line 7 def initialize(params = {}) @entries = params[:entries] || [] end |
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
5 6 7 |
# File 'lib/libledger/journal.rb', line 5 def entries @entries end |
Class Method Details
.from_file(file) ⇒ Object
22 23 24 |
# File 'lib/libledger/journal.rb', line 22 def from_file(file) from_text(File.read(file)) end |
Instance Method Details
#to_s ⇒ Object
11 12 13 |
# File 'lib/libledger/journal.rb', line 11 def to_s @entries.map(&:to_s).join("\n") end |