Class: Tableau::Class

Inherits:
Object
  • Object
show all
Defined in:
lib/tableau/class.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(day, time, options = {}) ⇒ Class

Returns a new instance of Class.



21
22
23
24
25
26
# File 'lib/tableau/class.rb', line 21

def initialize(day, time, options = {})
  @day = day
  @time = time
  @weeks = Array.new
  defaults.merge!(options)
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



4
5
6
# File 'lib/tableau/class.rb', line 4

def code
  @code
end

#dayObject

Returns the value of attribute day.



4
5
6
# File 'lib/tableau/class.rb', line 4

def day
  @day
end

#intervalsObject

Returns the value of attribute intervals.



4
5
6
# File 'lib/tableau/class.rb', line 4

def intervals
  @intervals
end

#locationObject

Returns the value of attribute location.



4
5
6
# File 'lib/tableau/class.rb', line 4

def location
  @location
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/tableau/class.rb', line 4

def name
  @name
end

#timeObject

Returns the value of attribute time.



4
5
6
# File 'lib/tableau/class.rb', line 4

def time
  @time
end

#tutorObject

Returns the value of attribute tutor.



4
5
6
# File 'lib/tableau/class.rb', line 4

def tutor
  @tutor
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/tableau/class.rb', line 4

def type
  @type
end

#weeksObject

Returns the value of attribute weeks.



4
5
6
# File 'lib/tableau/class.rb', line 4

def weeks
  @weeks
end

Instance Method Details

#defaultsObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/tableau/class.rb', line 8

def defaults
  def_opts = {
    type: '',
    location: '',
    name: '',
    tutor: '',
    intervals: 4,
    day:  0,
    code: 0,
    time: Time.new
  }
end

#durationObject

Duration of the class in hours



29
30
31
# File 'lib/tableau/class.rb', line 29

def duration
  @intervals / 4
end