Class: Textbringer::Presentation::SlideList
- Inherits:
-
Object
- Object
- Textbringer::Presentation::SlideList
- Defined in:
- lib/textbringer/presentation/slide_list.rb
Instance Method Summary collapse
- #backward_slide ⇒ Object
- #current ⇒ Object
- #forward_slide ⇒ Object
-
#initialize(s) ⇒ SlideList
constructor
A new instance of SlideList.
- #size ⇒ Object
Constructor Details
#initialize(s) ⇒ SlideList
Returns a new instance of SlideList.
16 17 18 19 20 21 22 |
# File 'lib/textbringer/presentation/slide_list.rb', line 16 def initialize(s) @list = s.scan(/^#+ *(.*?)\n(.*?)(?:(?=^#)|\z)/m).map.with_index { |(title, body), i| Slide.new(i + 1, title.strip, body.strip) } @index = 0 end |
Instance Method Details
#backward_slide ⇒ Object
38 39 40 41 42 |
# File 'lib/textbringer/presentation/slide_list.rb', line 38 def if @index > 0 @index -= 1 end end |
#current ⇒ Object
28 29 30 |
# File 'lib/textbringer/presentation/slide_list.rb', line 28 def current @list[@index] end |
#forward_slide ⇒ Object
32 33 34 35 36 |
# File 'lib/textbringer/presentation/slide_list.rb', line 32 def if @index < @list.size - 1 @index += 1 end end |
#size ⇒ Object
24 25 26 |
# File 'lib/textbringer/presentation/slide_list.rb', line 24 def size @list.size end |