Class: Slot

Inherits:
Object
  • Object
show all
Defined in:
lib/gthc/olson/slot.rb

Overview

Slots objects make up the ScheduleGrid input.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(personID, startDate, endDate, phase, isNight, status, row, col, weight = 1) ⇒ Slot

Returns a new instance of Slot.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gthc/olson/slot.rb', line 12

def initialize(personID, startDate, endDate, phase, isNight, status, row, col, weight=1)
  @personID = personID
  @startDate = startDate
  @endDate = endDate
  @phase = phase
  @isNight = isNight
  @status = status
  @row = row
  @col = col
  @weight = 1
  @ids = nil
end

Instance Attribute Details

#colObject

Returns the value of attribute col.



4
5
6
# File 'lib/gthc/olson/slot.rb', line 4

def col
  @col
end

#endDateObject

Returns the value of attribute endDate.



4
5
6
# File 'lib/gthc/olson/slot.rb', line 4

def endDate
  @endDate
end

#idsObject

Returns the value of attribute ids.



4
5
6
# File 'lib/gthc/olson/slot.rb', line 4

def ids
  @ids
end

#isNightObject

Returns the value of attribute isNight.



4
5
6
# File 'lib/gthc/olson/slot.rb', line 4

def isNight
  @isNight
end

#personIDObject

Returns the value of attribute personID.



4
5
6
# File 'lib/gthc/olson/slot.rb', line 4

def personID
  @personID
end

#phaseObject

Returns the value of attribute phase.



4
5
6
# File 'lib/gthc/olson/slot.rb', line 4

def phase
  @phase
end

#rowObject

Returns the value of attribute row.



4
5
6
# File 'lib/gthc/olson/slot.rb', line 4

def row
  @row
end

#startDateObject

Returns the value of attribute startDate.



4
5
6
# File 'lib/gthc/olson/slot.rb', line 4

def startDate
  @startDate
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/gthc/olson/slot.rb', line 4

def status
  @status
end

#weightObject

Returns the value of attribute weight.



4
5
6
# File 'lib/gthc/olson/slot.rb', line 4

def weight
  @weight
end

Class Method Details

.attr_accessor(*vars) ⇒ Object



31
32
33
34
35
# File 'lib/gthc/olson/slot.rb', line 31

def self.attr_accessor(*vars)
  @attributes ||= []
  @attributes.concat vars
  super(*vars)
end

.attributesObject



37
38
39
# File 'lib/gthc/olson/slot.rb', line 37

def self.attributes
  @attributes
end

Instance Method Details

#attributesObject



41
42
43
# File 'lib/gthc/olson/slot.rb', line 41

def attributes
  self.class.attributes
end

#to_hashObject



25
26
27
28
29
# File 'lib/gthc/olson/slot.rb', line 25

def to_hash
  hash = {}
  instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
  hash
end