Class: MingleEvents::EntryCache::Entries::Enumerator
- Inherits:
-
Object
- Object
- MingleEvents::EntryCache::Entries::Enumerator
- Defined in:
- lib/mingle_events/entry_cache.rb
Instance Method Summary collapse
-
#initialize(dir, first, last) ⇒ Enumerator
constructor
A new instance of Enumerator.
- #next ⇒ Object
Constructor Details
#initialize(dir, first, last) ⇒ Enumerator
Returns a new instance of Enumerator.
88 89 90 91 92 |
# File 'lib/mingle_events/entry_cache.rb', line 88 def initialize(dir, first, last) @dir, @first, @last = dir, first, last @last_pos = :limbo @current_pos = first end |
Instance Method Details
#next ⇒ Object
94 95 96 97 98 99 100 101 |
# File 'lib/mingle_events/entry_cache.rb', line 94 def next raise StopIteration.new unless has_next? current_entry_info = @dir.file(@current_pos) {|f| YAML.load(f) } Feed::Entry.from_snippet(current_entry_info[:entry_xml]).tap do @last_pos = @current_pos @current_pos = current_entry_info[:next_entry_file_path] end end |