Class: MingleEvents::EntryCache::Entries

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/mingle_events/entry_cache.rb

Defined Under Namespace

Classes: Enumerator

Instance Method Summary collapse

Constructor Details

#initialize(state_dir, first_info_file, last_info_file) ⇒ Entries

Returns a new instance of Entries.



109
110
111
112
113
# File 'lib/mingle_events/entry_cache.rb', line 109

def initialize(state_dir, first_info_file, last_info_file)
  @dir = state_dir
  @first_info_file = first_info_file
  @last_info_file = last_info_file
end

Instance Method Details

#each(&block) ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
# File 'lib/mingle_events/entry_cache.rb', line 115

def each(&block)
  enumerator = Enumerator.new(@dir, @first_info_file, @last_info_file)
  return enumerator unless block_given?
  loop do
    begin
      yield(enumerator.next)
    rescue StopIteration
      break
    end
  end
end