Class: OpenStudio::Analysis::AlgorithmAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio/analysis/algorithm_attributes.rb

Instance Method Summary collapse

Constructor Details

#initializeAlgorithmAttributes

Create a new instance of an algorithm



44
45
46
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 44

def initialize
  @attributes = {}
end

Instance Method Details

#[](name) ⇒ Object



60
61
62
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 60

def [](name)
  @attributes[name]
end

#set_attribute(attribute_name, attribute_value) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 48

def set_attribute(attribute_name, attribute_value)
  @attributes[attribute_name] = attribute_value
  begin
    unless Float(attribute_value).nil?
      if Float(attribute_value).abs >= Float('1.0e+19')
        raise "ERROR: Attribute `#{attribute_name}` is greater than 1E19. This may cause failures."
      end
    end
  rescue ArgumentError, TypeError
  end
end

#to_hash(_version = 1) ⇒ Object



64
65
66
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 64

def to_hash(_version = 1)
  @attributes
end