lib/openstudio/analysis/workflow.rb in openstudio-analysis-1.0.0.rc9 vs lib/openstudio/analysis/workflow.rb in openstudio-analysis-1.0.0.rc10
- old
+ new
@@ -2,11 +2,11 @@
module OpenStudio
module Analysis
class Workflow
attr_reader :items
# allow users to access the items via the measures attribute accessor
- alias_method :measures, :items
+ alias measures items
# Create an instance of the OpenStudio::Analysis::Workflow
#
# @return [Object] An OpenStudio::Analysis::Workflow object
def initialize
@@ -44,16 +44,16 @@
end
if measure_hash.nil? && File.exist?(File.join(local_path_to_measure, 'measure.json'))
measure_hash = JSON.parse(File.read(File.join(local_path_to_measure, 'measure.json')), symbolize_names: true)
elsif measure_hash.nil?
- fail 'measure.json was not found and was not automatically created'
+ raise 'measure.json was not found and was not automatically created'
end
add_measure(instance_name, instance_display_name, local_path_to_measure, measure_hash)
else
- fail "could not find measure to add to workflow #{local_path_to_measure}"
+ raise "could not find measure to add to workflow #{local_path_to_measure}"
end
@items.last
end
@@ -184,11 +184,11 @@
# @params instance_name [String] instance name of the measure
# @return [Object] The WorkflowStep with the instance_name
def find_measure(instance_name)
@items.find { |i| i.name == instance_name }
end
- alias_method :find_workflow_step, :find_measure
+ alias find_workflow_step find_measure
# Return all the variables in the analysis as an array. The list that is returned is read only.
#
# @return [Array] All variables in the workflow
def all_variables
@@ -207,11 +207,11 @@
arr << temp_h
end
h = arr
else
- fail "Version #{version} not yet implemented for to_hash"
+ raise "Version #{version} not yet implemented for to_hash"
end
h
end
@@ -220,11 +220,11 @@
# @return [String] JSON formatted string
def to_json(version = 1)
if version == 1
JSON.pretty_generate(to_hash(version))
else
- fail "Version #{version} not yet implemented for to_json"
+ raise "Version #{version} not yet implemented for to_json"
end
end
# Load from a from a hash
#
@@ -252,11 +252,11 @@
break
end
end
end
- fail "Could not find local measure when loading workflow for #{wf[:measure_definition_class_name]} in #{File.basename(wf[:measure_definition_directory])}. You may have to add measure paths to OpenStudio::Analysis.measure_paths" unless local_measure_dir
+ raise "Could not find local measure when loading workflow for #{wf[:measure_definition_class_name]} in #{File.basename(wf[:measure_definition_directory])}. You may have to add measure paths to OpenStudio::Analysis.measure_paths" unless local_measure_dir
o.add_measure_from_analysis_hash(wf[:name], wf[:display_name], local_measure_dir, wf)
end
o
@@ -270,10 +270,10 @@
o = nil
if File.exist? filename
j = JSON.parse(File.read(filename), symbolize_names: true)
o = OpenStudio::Analysis::Workflow.load(j)
else
- fail "Could not find workflow file #{filename}"
+ raise "Could not find workflow file #{filename}"
end
o
end
end