Class: ConfBuilder::Track

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(talk_factory) ⇒ Track

Returns a new instance of Track.



11
12
13
14
15
16
17
18
19
# File 'lib/track.rb', line 11

def initialize(talk_factory)
  @track_time = Time.local(2000,"jan",1,9,0,0) #start time - 9:00 AM
  @talk_factory = talk_factory
  @pre_lunch_talks = []
  @post_lunch_talks = []
  build_session(@pre_lunch_talks, 180)
  build_session(@post_lunch_talks, 240)
  self
end

Instance Attribute Details

#post_lunch_talksObject (readonly)

Returns the value of attribute post_lunch_talks.



9
10
11
# File 'lib/track.rb', line 9

def post_lunch_talks
  @post_lunch_talks
end

#pre_lunch_talksObject (readonly)

Returns the value of attribute pre_lunch_talks.



8
9
10
# File 'lib/track.rb', line 8

def pre_lunch_talks
  @pre_lunch_talks
end

Instance Method Details

#build_session(session, duration) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/track.rb', line 21

def build_session(session, duration)
  while duration > 0
    talk_to_add = @talk_factory.next_talk(duration)
    unless talk_to_add.nil?
      session << talk_to_add
      duration -= talk_to_add.duration
    else
      break
    end
  end
end

#lunchObject

print lunch



41
42
43
# File 'lib/track.rb', line 41

def lunch # print lunch 
  p "#{@track_time.strftime("%-l:%M %p")} Lunch"
end

#networking_eventObject

print networking event



45
46
47
# File 'lib/track.rb', line 45

def networking_event # print networking event
  p "#{@track_time.strftime("%-l:%M %p")} Networking event"
end

print talks for track



33
34
35
36
37
38
39
# File 'lib/track.rb', line 33

def print # print talks for track
  talk_and_time_list(@pre_lunch_talks).each {|item| p item}
  lunch
  @track_time += 3600
  talk_and_time_list(@post_lunch_talks).each {|item| p item}
  networking_event
end