class Diakonos::Finding

Public Class Methods

confirm(range_, regexps, lines, search_area, regexp_match) click to toggle source
# File lib/diakonos/finding.rb, line 6
def self.confirm(range_, regexps, lines, search_area, regexp_match)
  matches = true
  range = range_.dup

  i = range.start_row + 1
  regexps[1..-1].each do |re|
    if lines[i] !~ re
      matches = false
      break
    end
    range.end_row = i
    range.end_col = Regexp.last_match[0].length
    i += 1
  end

  if (
    matches &&
    search_area.contains?( range.start_row, range.start_col ) &&
    search_area.contains?( range.end_row, range.end_col - 1 )
  )
    Finding.new(range, regexp_match)
  end
end
new(range, regexp_match) click to toggle source
# File lib/diakonos/finding.rb, line 30
def initialize(range, regexp_match)
  @range = range
  @regexp_match = regexp_match
end

Public Instance Methods

captured_group(index) click to toggle source
# File lib/diakonos/finding.rb, line 35
def captured_group(index)
  @regexp_match[index]
end