Class: ConfBuilder::TalkFactory
- Inherits:
-
Object
- Object
- ConfBuilder::TalkFactory
- Defined in:
- lib/talk_factory.rb
Instance Method Summary collapse
-
#initialize(lightning_talks, thirty_min_talks, fortyfive_min_talks, sixty_min_talks) ⇒ TalkFactory
constructor
A new instance of TalkFactory.
- #next_talk(duration) ⇒ Object
Constructor Details
#initialize(lightning_talks, thirty_min_talks, fortyfive_min_talks, sixty_min_talks) ⇒ TalkFactory
Returns a new instance of TalkFactory.
3 4 5 6 7 8 9 |
# File 'lib/talk_factory.rb', line 3 def initialize(lightning_talks, thirty_min_talks, fortyfive_min_talks, sixty_min_talks) @lightning_talks = lightning_talks @thirty_min_talks = thirty_min_talks @fortyfive_min_talks = fortyfive_min_talks @sixty_min_talks = sixty_min_talks self end |
Instance Method Details
#next_talk(duration) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/talk_factory.rb', line 11 def next_talk(duration) if !@sixty_min_talks.empty? && (@sixty_min_talks.last.duration <= duration) @sixty_min_talks.pop elsif !@fortyfive_min_talks.empty? && (@fortyfive_min_talks.last.duration <= duration) @fortyfive_min_talks.pop elsif !@thirty_min_talks.empty? && (@thirty_min_talks.last.duration <= duration) @thirty_min_talks.pop elsif !@lightning_talks.empty? @lightning_talks.pop end end |