Class: Egg::DocumentParser
- Inherits:
-
Object
- Object
- Egg::DocumentParser
- Defined in:
- lib/egg/parsers/document_parser.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
Instance Method Summary collapse
-
#initialize(html) ⇒ DocumentParser
constructor
A new instance of DocumentParser.
- #to_ofx ⇒ Object
Constructor Details
#initialize(html) ⇒ DocumentParser
Returns a new instance of DocumentParser.
7 8 9 |
# File 'lib/egg/parsers/document_parser.rb', line 7 def initialize(html) @doc = Hpricot(html) end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
5 6 7 |
# File 'lib/egg/parsers/document_parser.rb', line 5 def doc @doc end |
Instance Method Details
#to_ofx ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/egg/parsers/document_parser.rb', line 11 def to_ofx account = Egg::Account.new('GBP', card_number) statement = Egg::Statement.new(statement_date, closing_balance, account) each_transaction do |transaction_row| next if transaction_row.skip? transaction = Egg::Transaction.new(transaction_row.date, transaction_row.description, transaction_row.money) statement.add_transaction(transaction) end Ofx::Statement.new(statement).to_xml end |