Class: Pione::Package::ScenarioInfo

Inherits:
StructX
  • Object
show all
Defined in:
lib/pione/package/scenario-info.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.read(src) ⇒ Object

Read the scenario information JSON source. The source is a string or location of the file.



11
12
13
14
# File 'lib/pione/package/scenario-info.rb', line 11

def self.read(src)
  data = JSON.load(src.is_a?(Location::DataLocation) ? src.read : src)
  new(name: data["ScenarioName"], textual_param_sets: data["ParamSet"], inputs: data["Inputs"], outputs: data["Outputs"])
end

Instance Method Details

#filepathsObject

Return file paths of the scenario.



17
18
19
20
21
22
23
# File 'lib/pione/package/scenario-info.rb', line 17

def filepaths
  list = []
  list << "Scenario.pione"
  list += inputs
  list += outputs
  return list
end

#to_json(*args) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/pione/package/scenario-info.rb', line 25

def to_json(*args)
  data = Hash.new
  data["ScenarioName"] = name
  data["ParamSet"] = textual_param_sets
  data["Inputs"] = inputs.sort
  data["Outputs"] = outputs.sort
  data.to_json(*args)
end