Class: SchedulesCSV
- Inherits:
-
Object
- Object
- SchedulesCSV
- Defined in:
- lib/energyplus/SchedulesCSV.rb
Instance Attribute Summary collapse
-
#schedules ⇒ Object
Returns the value of attribute schedules.
Instance Method Summary collapse
-
#initialize(path) ⇒ SchedulesCSV
constructor
A new instance of SchedulesCSV.
- #process_schedules ⇒ Object
Constructor Details
#initialize(path) ⇒ SchedulesCSV
Returns a new instance of SchedulesCSV.
134 135 136 137 138 139 140 141 142 |
# File 'lib/energyplus/SchedulesCSV.rb', line 134 def initialize(path) @schedules = Hash.new if File.exists?(path) @path = Pathname.new(path) process_schedules else @path = nil end end |
Instance Attribute Details
#schedules ⇒ Object
Returns the value of attribute schedules.
132 133 134 |
# File 'lib/energyplus/SchedulesCSV.rb', line 132 def schedules @schedules end |
Instance Method Details
#process_schedules ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/energyplus/SchedulesCSV.rb', line 144 def process_schedules File.open(@path) do |f| name = "" schedule_string = "" while line = f.gets if line.chomp.empty? if not name.empty? new_schedule = Schedule.new(schedule_string) @schedules[new_schedule.name] = new_schedule end name = "" schedule_string = "" next end if name.empty? name = line.chomp schedule_string = line else schedule_string += line end end end end |