Class: Mindee::Product::FR::BankStatement::BankStatementV2Transactions
- Inherits:
-
Array
- Object
- Array
- Mindee::Product::FR::BankStatement::BankStatementV2Transactions
- Defined in:
- lib/mindee/product/fr/bank_statement/bank_statement_v2_transactions.rb
Overview
The list of values that represent the financial transactions recorded in a bank statement.
Instance Attribute Summary collapse
-
#entries ⇒ Array<BankStatementV2Transaction>
readonly
Entries.
Class Method Summary collapse
-
.line_items_separator(char) ⇒ String
Creates a line of rST table-compliant string separators.
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ BankStatementV2Transactions
constructor
A new instance of BankStatementV2Transactions.
- #to_s ⇒ String
Constructor Details
#initialize(prediction, page_id) ⇒ BankStatementV2Transactions
Returns a new instance of BankStatementV2Transactions.
17 18 19 20 21 22 |
# File 'lib/mindee/product/fr/bank_statement/bank_statement_v2_transactions.rb', line 17 def initialize(prediction, page_id) entries = prediction.map do |entry| BankStatement::BankStatementV2Transaction.new(entry, page_id) end super(entries) end |
Instance Attribute Details
#entries ⇒ Array<BankStatementV2Transaction> (readonly)
Entries.
13 14 15 |
# File 'lib/mindee/product/fr/bank_statement/bank_statement_v2_transactions.rb', line 13 def entries @entries end |
Class Method Details
.line_items_separator(char) ⇒ String
Creates a line of rST table-compliant string separators.
27 28 29 30 31 32 33 |
# File 'lib/mindee/product/fr/bank_statement/bank_statement_v2_transactions.rb', line 27 def self.line_items_separator(char) out_str = String.new out_str << "+#{char * 12}" out_str << "+#{char * 12}" out_str << "+#{char * 38}" out_str end |
Instance Method Details
#to_s ⇒ String
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mindee/product/fr/bank_statement/bank_statement_v2_transactions.rb', line 36 def to_s return '' if empty? lines = map do |entry| "\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}" end.join out_str = String.new out_str << ("\n#{self.class.line_items_separator('-')}\n ") out_str << ' | Amount ' out_str << ' | Date ' out_str << ' | Description ' out_str << (" |\n#{self.class.line_items_separator('=')}") out_str + lines end |