Class: EnergyPlus::IdfObject

Inherits:
Object
  • Object
show all
Defined in:
lib/energyplus/IdfObject.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commentObject

Returns the value of attribute comment.



23
24
25
# File 'lib/energyplus/IdfObject.rb', line 23

def comment
  @comment
end

#fieldsObject

Returns the value of attribute fields.



23
24
25
# File 'lib/energyplus/IdfObject.rb', line 23

def fields
  @fields
end

#typeObject

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_sObject



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