Class: Pione::Agent::DirInputGeneratorMethod
- Inherits:
-
InputGeneratorMethod
- Object
- InputGeneratorMethod
- Pione::Agent::DirInputGeneratorMethod
- Defined in:
- lib/pione/agent/input-generator.rb
Overview
DirGeneratorMethod is a directory based generator.
Instance Attribute Summary
Attributes inherited from InputGeneratorMethod
Instance Method Summary collapse
- #generate ⇒ Object
- #init ⇒ Object
-
#initialize(space, input_location, stream) ⇒ DirInputGeneratorMethod
constructor
A new instance of DirInputGeneratorMethod.
Methods inherited from InputGeneratorMethod
Constructor Details
#initialize(space, input_location, stream) ⇒ DirInputGeneratorMethod
Returns a new instance of DirInputGeneratorMethod.
138 139 140 141 |
# File 'lib/pione/agent/input-generator.rb', line 138 def initialize(space, input_location, stream) super @table ||= Hash.new end |
Instance Method Details
#generate ⇒ Object
154 155 156 157 158 159 160 |
# File 'lib/pione/agent/input-generator.rb', line 154 def generate location = @enum.next if new_file?(location.basename, location.mtime) @table[location.basename] = location.mtime return TupleSpace::DataTuple.new(InputGenerator::DOMAIN, location.basename, location, location.mtime) end end |
#init ⇒ Object
143 144 145 146 147 148 149 150 151 152 |
# File 'lib/pione/agent/input-generator.rb', line 143 def init # save entries as Enumerator if input_location # files in the directory @enum = input_location.file_entries.to_enum else # no files @enum = [].to_enum end end |