Sha256: 404579cd9075e5bc3afac9744cd8f73768ada02af8f44e82991b2950898c7b9e

Contents?: true

Size: 930 Bytes

Versions: 3

Compression:

Stored size: 930 Bytes

Contents

class String
  def extract_column(column)
    self[column[:start]..column[:end]]
  end

  def remove_empty_lines
    self.gsub /^$\n/, ''
  end

  def remove_multiple_lines
    self.gsub('\n', '')
  end

  def remove_white_spaces
    self.gsub(/\s+/, "")
  end

  def reduce_to_singular_white_space
    self.gsub(/\s+/, " ")
  end

  def remove_commas
    return self.gsub(/,/, '')
  end


  def get_text_between_markers(marker1, marker2)
    self[/#{Regexp.escape(marker1)}(.*?)#{Regexp.escape(marker2)}/m, 1]
  end

  def get_text_after_marker(marker)
    self.partition(marker).last
  end

  def get_date_string
    self[0...10]
  end

  def get_first_line
    self.lines[0]
  end

  def is_date?
    begin
      Date.parse(self)
    rescue ArgumentError
      return false
    end
    return true
  end

  def convert_to_date
    Date.strptime(self, '%d-%b-%Y')
  end

  def get_numbers
    self.remove_commas.to_f
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ng-bank-parser-0.1.7 lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb
ng-bank-parser-0.1.6 lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb
ng-bank-parser-0.1.5 lib/ng-bank-parser/parsers/uba-pdf-parser/classes/string.rb