Class: Origen::Utility::FileDiff::InputFile

Inherits:
Array show all
Defined in:
lib/origen/utility/file_diff.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Array

#dups, #dups?, #dups_with_index, #ids, #include_hash?, #include_hash_with_key?

Constructor Details

#initializeInputFile

Returns a new instance of InputFile.



7
8
9
# File 'lib/origen/utility/file_diff.rb', line 7

def initialize
  self.pointer = 0
end

Instance Attribute Details

#pointerObject

Returns the value of attribute pointer.



5
6
7
# File 'lib/origen/utility/file_diff.rb', line 5

def pointer
  @pointer
end

Instance Method Details

#advance_pointer!Object



15
16
17
# File 'lib/origen/utility/file_diff.rb', line 15

def advance_pointer!
  self.pointer += 1
end

#current_lineObject



11
12
13
# File 'lib/origen/utility/file_diff.rb', line 11

def current_line
  self[pointer]
end

#find_current_line_in(other) ⇒ Object



19
20
21
22
# File 'lib/origen/utility/file_diff.rb', line 19

def find_current_line_in(other)
  index = (other[other.pointer..-1] || []).index(current_line)
  index.nil? ? nil : other.pointer + index
end