class String

Public Instance Methods

convert_string_to_date() click to toggle source
# File lib/ng-bank-parser/parsers/gtb-excel-parser/helpers.rb, line 20
def convert_string_to_date
        date_string = self.scan(/.....\d*..\d{4}/)[0]
        Date.strptime(date_string,"%d/%b/%Y")
end
convert_to_date() click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 52
def convert_to_date
  Date.strptime(self, '%d-%b-%Y')
end
convert_to_number() click to toggle source
# File lib/ng-bank-parser/parsers/gtb-excel-parser/helpers.rb, line 14
def convert_to_number
        self.to_s.scan(/\b-?[\d.]+/).join.to_f
end
extract_column(column) click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 2
def extract_column(column)
  self[column[:start]..column[:end]]
end
get_date_string() click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 35
def get_date_string
  self[0...10]
end
get_date_strings() click to toggle source
# File lib/ng-bank-parser/parsers/gtb-excel-parser/helpers.rb, line 24
def get_date_strings
        self.scan(/.....\d*..\d{4}/)
end
get_first_line() click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 39
def get_first_line
  self.lines[0]
end
get_numbers() click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 56
def get_numbers
  self.remove_commas.to_f
end
get_text_after_marker(marker) click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 31
def get_text_after_marker(marker)
  self.partition(marker).last
end
get_text_between_markers(marker1, marker2) click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 27
def get_text_between_markers(marker1, marker2)
  self[/#{Regexp.escape(marker1)}(.*?)#{Regexp.escape(marker2)}/m, 1]
end
is_date?() click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 43
def is_date?
  begin
    Date.parse(self)
  rescue ArgumentError
    return false
  end
  return true
end
reduce_to_singular_white_space() click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 18
def reduce_to_singular_white_space
  self.gsub(/\s+/, " ")
end
remove_commas() click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 22
def remove_commas
  return self.gsub(/,/, '')
end
remove_empty_lines() click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 6
def remove_empty_lines
  self.gsub /^$\n/, ''
end
remove_multiple_lines() click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 10
def remove_multiple_lines
  self.gsub('\n', '')
end
remove_white_spaces() click to toggle source
# File lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb, line 14
def remove_white_spaces
  self.gsub(/\s+/, "")
end
return_first_number() click to toggle source
# File lib/ng-bank-parser/parsers/gtb-excel-parser/helpers.rb, line 17
def return_first_number
        self.scan(/\d+/)[0]
end