module Parser

Public Class Methods

parse(file_path) click to toggle source
# File lib/parser.rb, line 2
def self.parse file_path
  @file_path = file_path
  @matches = []
  parse_matches
  filter_matches
end

Private Class Methods

filter_matches() click to toggle source
# File lib/parser.rb, line 19
def self.filter_matches
  @matches.each { |match| match[:note].gsub!($pattern, '\3').strip! }
end
parse_matches() click to toggle source
# File lib/parser.rb, line 11
def self.parse_matches
  File.open(@file_path, 'r:ASCII-8BIT').each_with_index do |content, index|
    @matches << { filepath: @file_path,
                  note: content,
                  line: index } if content =~ $pattern
  end
end