Class: JarTools::Diff::EntryIterator

Inherits:
Object
  • Object
show all
Defined in:
lib/jartools/diff.rb

Defined Under Namespace

Classes: AnalyzableEntry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jarfile, container_files) ⇒ EntryIterator

Returns a new instance of EntryIterator.



76
77
78
79
80
81
82
# File 'lib/jartools/diff.rb', line 76

def initialize(jarfile, container_files)
  @jarfile = jarfile
  @entries = read_directory
  @container_files = container_files
  @index = 0
  @current_entry_cache = nil
end

Instance Attribute Details

#indexObject

Returns the value of attribute index.



74
75
76
# File 'lib/jartools/diff.rb', line 74

def index
  @index
end

Instance Method Details

#advanceObject



95
96
97
98
# File 'lib/jartools/diff.rb', line 95

def advance
  @index += 1
  @current_entry_cache = nil
end

#currentObject



84
85
86
87
88
89
# File 'lib/jartools/diff.rb', line 84

def current
  unless exhausted?
    @current_entry_cache ||=
      AnalyzableEntry.new(@jarfile, @entries[index], @container_files)
  end
end

#exhausted?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/jartools/diff.rb', line 91

def exhausted?
  index >= @entries.size
end