Class: CFBundle::Resource::Enumerator

Inherits:
Object
  • Object
show all
Defined in:
lib/cfbundle/resource.rb

Overview

Performs the enumeration of a bundle’s resources.

Instance Method Summary collapse

Constructor Details

#initialize(bundle, subdirectory, localization, preferred_languages) ⇒ Enumerator



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

def initialize(bundle, subdirectory, localization, preferred_languages)
  @bundle = bundle
  @directory = PathUtils.join(bundle.resources_directory, subdirectory)
  @localizations = localizations_for(bundle, localization,
                                     preferred_languages)
  @enumerator = [].to_enum
end

Instance Method Details

#nextResource

Returns the next resource in the bundle.

Raises:

  • (StopIteration)


88
89
90
91
92
93
# File 'lib/cfbundle/resource.rb', line 88

def next
  Resource.new(@bundle, @enumerator.next)
rescue StopIteration
  @enumerator = next_enumerator
  retry
end