Class: TP::SlideDeck
- Inherits:
-
Object
- Object
- TP::SlideDeck
- Defined in:
- lib/tp/slide_deck.rb
Instance Attribute Summary collapse
-
#cursor ⇒ Object
readonly
Returns the value of attribute cursor.
-
#slides ⇒ Object
readonly
Returns the value of attribute slides.
Instance Method Summary collapse
- #current ⇒ Object (also: #current_frame)
- #ended? ⇒ Boolean
- #frames ⇒ Object
- #height ⇒ Object
-
#initialize(slides) ⇒ SlideDeck
constructor
A new instance of SlideDeck.
- #maximum_hard_width ⇒ Object
- #maximum_header_length ⇒ Object
- #maximum_width ⇒ Object
- #next ⇒ Object
- #previous ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(slides) ⇒ SlideDeck
Returns a new instance of SlideDeck.
5 6 7 8 |
# File 'lib/tp/slide_deck.rb', line 5 def initialize() @cursor = 0 @slides = end |
Instance Attribute Details
#cursor ⇒ Object (readonly)
Returns the value of attribute cursor.
3 4 5 |
# File 'lib/tp/slide_deck.rb', line 3 def cursor @cursor end |
#slides ⇒ Object (readonly)
Returns the value of attribute slides.
3 4 5 |
# File 'lib/tp/slide_deck.rb', line 3 def @slides end |
Instance Method Details
#current ⇒ Object Also known as: current_frame
10 11 12 |
# File 'lib/tp/slide_deck.rb', line 10 def current frames[cursor] end |
#ended? ⇒ Boolean
15 16 17 |
# File 'lib/tp/slide_deck.rb', line 15 def ended? not current end |
#frames ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tp/slide_deck.rb', line 19 def frames return @frames if @frames @frames = [] .each do || @frames |= .frames end @frames end |
#height ⇒ Object
51 52 53 |
# File 'lib/tp/slide_deck.rb', line 51 def height .collect(&:height).max end |
#maximum_hard_width ⇒ Object
63 64 65 |
# File 'lib/tp/slide_deck.rb', line 63 def maximum_hard_width .select(&:hard_width?).collect(&:width).max end |
#maximum_header_length ⇒ Object
55 56 57 |
# File 'lib/tp/slide_deck.rb', line 55 def maximum_header_length .collect(&:header).map(&:length).max end |
#maximum_width ⇒ Object
59 60 61 |
# File 'lib/tp/slide_deck.rb', line 59 def maximum_width .collect(&:width).max end |
#next ⇒ Object
31 32 33 34 35 |
# File 'lib/tp/slide_deck.rb', line 31 def next @cursor += 1 current end |
#previous ⇒ Object
37 38 39 40 41 |
# File 'lib/tp/slide_deck.rb', line 37 def previous @cursor -= 1 current end |
#width ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/tp/slide_deck.rb', line 43 def width if maximum_hard_width [maximum_header_length, maximum_hard_width].max else [maximum_width, 80].min end end |