module NgBankParser::StatementUtils

Public Instance Methods

get_all_text(reader) click to toggle source
# File lib/ng-bank-parser/parsers/firstbank-pdf-parser/statement_utils.rb, line 10
def get_all_text reader
  all_lines = []
  reader.pages.each do |page|
    lines_of_page = page.text.remove_empty_lines.lines
    all_lines += lines_of_page
  end
  all_lines
end
get_first_page_text(reader) click to toggle source
# File lib/ng-bank-parser/parsers/firstbank-pdf-parser/statement_utils.rb, line 4
def get_first_page_text reader
  lines = reader.pages.first.text.remove_empty_lines.lines #lines without the spaces
  lines.map{ |line| split_on_2_or_more_spaces(line) }
end
get_page_text(page_text) click to toggle source
# File lib/ng-bank-parser/parsers/firstbank-pdf-parser/statement_utils.rb, line 20
def get_page_text page_text
  page_text.text.remove_empty_lines.lines
end
get_pages(reader) click to toggle source
# File lib/ng-bank-parser/parsers/firstbank-pdf-parser/statement_utils.rb, line 25
def get_pages reader
  reader.pages
end
get_transaction_table_index(lines) click to toggle source
# File lib/ng-bank-parser/parsers/firstbank-pdf-parser/statement_utils.rb, line 30
def get_transaction_table_index lines
  lines_in_file = lines.map{ |line| split_on_2_or_more_spaces(line) }
  lines_in_file.each_with_index do |line, index|
    if line[0] == 'TransDate'
        return index + 1
    end
  end
  return -1 #no transactions found on page
end

Private Instance Methods

remove_empty_lines() click to toggle source
# File lib/ng-bank-parser/parsers/firstbank-pdf-parser/statement_utils.rb, line 47
def remove_empty_lines
  self.gsub /^$\n/, ''
end
split_on_2_or_more_spaces(str) click to toggle source
# File lib/ng-bank-parser/parsers/firstbank-pdf-parser/statement_utils.rb, line 43
def split_on_2_or_more_spaces str
  str.strip.split(/\s\s+/)
end