Class: Pione::Package::ScenarioReader
- Inherits:
-
Object
- Object
- Pione::Package::ScenarioReader
- Defined in:
- lib/pione/package/scenario-reader.rb
Overview
ScenarioReader is a reader for scenario location.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(location) ⇒ ScenarioReader
constructor
A new instance of ScenarioReader.
- #read ⇒ Object
Constructor Details
#initialize(location) ⇒ ScenarioReader
Returns a new instance of ScenarioReader.
11 12 13 14 15 |
# File 'lib/pione/package/scenario-reader.rb', line 11 def initialize(location) @location = location @document_location = @location + "Scenario.pione" @info_location = @location + "pione-scenario.json" end |
Class Method Details
.read(location) ⇒ Object
6 7 8 |
# File 'lib/pione/package/scenario-reader.rb', line 6 def read(location) new(location).read end |
Instance Method Details
#read ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pione/package/scenario-reader.rb', line 17 def read if @document_location.mtime > @info_location.mtime # update the information file and make handler by it new_info = ScenarioScanner.scan(@location) return ScenarioHandler.new(@locaiton, new_info).tap {|handler| handler.write_info_file} else # make handler by informaiton file ScenarioHandler.new(@location, ScenarioInfo.read(@info_location)) end end |