class MingleEvents::EntryCache::Entries::Enumerator

Public Class Methods

new(dir, first, last) click to toggle source
   # File lib/mingle_events/entry_cache.rb
88 def initialize(dir, first, last)
89   @dir, @first, @last = dir, first, last
90   @last_pos = :limbo
91   @current_pos = first
92 end

Public Instance Methods

next() click to toggle source
    # File lib/mingle_events/entry_cache.rb
 94 def next
 95   raise StopIteration.new unless has_next?
 96   current_entry_info = @dir.file(@current_pos) {|f| YAML.load(f) }
 97   Feed::Entry.from_snippet(current_entry_info[:entry_xml]).tap do
 98     @last_pos = @current_pos
 99     @current_pos = current_entry_info[:next_entry_file_path]
100   end
101 end

Private Instance Methods

has_next?() click to toggle source
    # File lib/mingle_events/entry_cache.rb
104 def has_next?
105   @current_pos && @last_pos != @last
106 end