Class: EnergyPlus::IdfObject
- Inherits:
-
Object
- Object
- EnergyPlus::IdfObject
- Defined in:
- lib/energyplus/IdfObject.rb
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #fieldString(fieldIdx) ⇒ Object
- #fieldValue(fieldIdx) ⇒ Object
-
#initialize(object_type, object_fields, object_comment) ⇒ IdfObject
constructor
A new instance of IdfObject.
- #to_s ⇒ Object
Constructor Details
#initialize(object_type, object_fields, object_comment) ⇒ IdfObject
Returns a new instance of IdfObject.
25 26 27 28 29 |
# File 'lib/energyplus/IdfObject.rb', line 25 def initialize(object_type, object_fields, object_comment) @type = object_type @fields = object_fields @comment = object_comment end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
23 24 25 |
# File 'lib/energyplus/IdfObject.rb', line 23 def comment @comment end |
#fields ⇒ Object
Returns the value of attribute fields.
23 24 25 |
# File 'lib/energyplus/IdfObject.rb', line 23 def fields @fields end |
#type ⇒ Object
Returns the value of attribute type.
23 24 25 |
# File 'lib/energyplus/IdfObject.rb', line 23 def type @type end |
Instance Method Details
#fieldString(fieldIdx) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/energyplus/IdfObject.rb', line 39 def fieldString(fieldIdx) fieldString = @fields[fieldIdx].split(',') fieldString = fieldString[0].split(';')[0].gsub(" ", "") return fieldString end |
#fieldValue(fieldIdx) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/energyplus/IdfObject.rb', line 31 def fieldValue(fieldIdx) fieldValue = @fields[fieldIdx].split(',') fieldValue = fieldValue[0].split(';')[0].gsub(" ", "") return fieldValue.to_f end |
#to_s ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/energyplus/IdfObject.rb', line 47 def to_s string = '' string << @comment + "\n" if @comment string << @type + "\n" @fields.each { |field| string << field + "\n" } string << "\n" end |