Class: ConferenceTracker::Session
- Inherits:
-
Object
- Object
- ConferenceTracker::Session
- Extended by:
- Forwardable
- Defined in:
- lib/conference_tracker/session.rb
Instance Attribute Summary collapse
-
#next_start ⇒ Object
readonly
Returns the value of attribute next_start.
Class Method Summary collapse
Instance Method Summary collapse
- #add(talk) ⇒ Object
-
#initialize(start, finish) ⇒ Session
constructor
A new instance of Session.
- #schedule ⇒ Object
Constructor Details
#initialize(start, finish) ⇒ Session
19 20 21 22 23 24 |
# File 'lib/conference_tracker/session.rb', line 19 def initialize(start, finish) @start = ConferenceTracker.parse(start) @finish = ConferenceTracker.parse(finish) @lapse = @finish - @start @talks = [] end |
Instance Attribute Details
#next_start ⇒ Object (readonly)
Returns the value of attribute next_start.
17 18 19 |
# File 'lib/conference_tracker/session.rb', line 17 def next_start @next_start end |
Class Method Details
.afternoon ⇒ Object
11 12 13 |
# File 'lib/conference_tracker/session.rb', line 11 def self.afternoon new("1pm", "5pm") end |
.morning ⇒ Object
7 8 9 |
# File 'lib/conference_tracker/session.rb', line 7 def self.morning new("9am", "12pm") end |
Instance Method Details
#add(talk) ⇒ Object
30 31 32 33 |
# File 'lib/conference_tracker/session.rb', line 30 def add(talk) return if talk.scheduled? || overflow?(talk) @talks << talk.schedule(next_start) end |
#schedule ⇒ Object
26 27 28 |
# File 'lib/conference_tracker/session.rb', line 26 def schedule @talks.map(&:to_s) end |