Class: Diakonos::Finding

Inherits:
Object show all
Defined in:
lib/diakonos/finding.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_row, start_col, end_row, end_col) ⇒ Finding

Returns a new instance of Finding


7
8
9
10
11
12
# File 'lib/diakonos/finding.rb', line 7

def initialize( start_row, start_col, end_row, end_col )
  @start_row = start_row
  @start_col = start_col
  @end_row = end_row
  @end_col = end_col
end

Instance Attribute Details

#end_colObject

Returns the value of attribute end_col


4
5
6
# File 'lib/diakonos/finding.rb', line 4

def end_col
  @end_col
end

#end_rowObject

Returns the value of attribute end_row


4
5
6
# File 'lib/diakonos/finding.rb', line 4

def end_row
  @end_row
end

#start_colObject (readonly)

Returns the value of attribute start_col


4
5
6
# File 'lib/diakonos/finding.rb', line 4

def start_col
  @start_col
end

#start_rowObject (readonly)

Returns the value of attribute start_row


4
5
6
# File 'lib/diakonos/finding.rb', line 4

def start_row
  @start_row
end

Instance Method Details

#match(regexps, lines) ⇒ Object


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/diakonos/finding.rb', line 14

def match( regexps, lines )
  retval = true

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

  retval
end