Class: Metacrunch::File::Source
- Inherits:
-
Object
- Object
- Metacrunch::File::Source
- Defined in:
- lib/metacrunch/file/source.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(filenames) ⇒ Source
constructor
A new instance of Source.
Constructor Details
#initialize(filenames) ⇒ Source
Returns a new instance of Source.
7 8 9 |
# File 'lib/metacrunch/file/source.rb', line 7 def initialize(filenames) @filenames = [*filenames].map{|f| f.presence}.compact end |
Instance Method Details
#each(&block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/metacrunch/file/source.rb', line 11 def each(&block) return enum_for(__method__) unless block_given? @filenames.each do |filename| if is_archive?(filename) read_archive(filename, &block) else read_regular_file(filename, &block) end end end |