Class: Statementor::Statement
- Inherits:
-
Object
- Object
- Statementor::Statement
- Defined in:
- lib/statementor/statement.rb
Instance Attribute Summary collapse
-
#transactions ⇒ Object
readonly
Returns the value of attribute transactions.
Instance Method Summary collapse
-
#initialize(file, bank) ⇒ Statement
constructor
A new instance of Statement.
- #parse ⇒ Object
Constructor Details
#initialize(file, bank) ⇒ Statement
Returns a new instance of Statement.
6 7 8 9 10 11 12 |
# File 'lib/statementor/statement.rb', line 6 def initialize(file, bank) raise UnsupportedBank unless SUPPORTED_BANKS.include?(bank) @file = file @bank = bank @transactions = [] parse end |
Instance Attribute Details
#transactions ⇒ Object (readonly)
Returns the value of attribute transactions.
5 6 7 |
# File 'lib/statementor/statement.rb', line 5 def transactions @transactions end |
Instance Method Details
#parse ⇒ Object
14 15 16 17 18 19 |
# File 'lib/statementor/statement.rb', line 14 def parse CSV.foreach(@file, :col_sep => ';', :headers => true, :encoding => 'ascii-8bit') do |row| @transactions << (@bank == :seb ? SebTransaction.new(row) : Transaction.new(row)) end raise NoTransactions if @transactions.empty? end |