lib/openstudio/analysis/translator/workflow.rb in openstudio-analysis-1.0.2 vs lib/openstudio/analysis/translator/workflow.rb in openstudio-analysis-1.0.3

- old
+ new

@@ -1,7 +1,7 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC. +# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC. # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # (1) Redistributions of source code must retain the above copyright notice, @@ -78,15 +78,13 @@ @osa[:problem][:workflow].each_with_index do |step, i| step_hash = {} step_hash[:measure_dir_name] = File.basename(step[:measure_definition_directory]) step_hash[:arguments] = {} # Measures can have no arguments -- make sure to catch it - if @osa[:problem][:workflow][i][:arguments] - @osa[:problem][:workflow][i][:arguments].each do |arg| - next if arg[:value].nil? - step_hash[:arguments][arg[:name].to_sym] = arg[:value] - end + @osa[:problem][:workflow][i][:arguments]&.each do |arg| + next if arg[:value].nil? + step_hash[:arguments][arg[:name].to_sym] = arg[:value] end step_hash[:name] = step[:name] if step[:name] step_hash[:description] = step[:description] if step[:description] if @options[:da_descriptions] step_hash[:name] = @options[:da_descriptions][i][:name] @@ -158,15 +156,13 @@ # Runs an array of OSD files def process_datapoints(osd_filename_array) r = [] osd_filename_array.each do |osd_file| - begin - r << process_datapoint(osd_file) - rescue StandardError => e - r << nil - puts "Warning: Failed to process datapoint #{osd_file} with error #{e.message} in #{e.backtrace.join('\n')}" - end + r << process_datapoint(osd_file) + rescue StandardError => e + r << nil + puts "Warning: Failed to process datapoint #{osd_file} with error #{e.message} in #{e.backtrace.join('\n')}" end r end end