Class: Slide
- Inherits:
-
Object
- Object
- Slide
- Defined in:
- lib/wee-pm/presentation.rb
Overview
Each slide consists of one or more overlays.
Instance Attribute Summary collapse
-
#annotations ⇒ Object
Returns the value of attribute annotations.
-
#content ⇒ Object
the rdoc content of the slide (excluding the title).
-
#converter ⇒ Object
Returns the value of attribute converter.
-
#style ⇒ Object
Returns the value of attribute style.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Slide
constructor
A new instance of Slide.
- #number_of_overlays ⇒ Object
- #render_annotations_on(r) ⇒ Object
- #render_on(r, overlay) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Slide
Returns a new instance of Slide.
121 122 123 124 125 126 127 128 |
# File 'lib/wee-pm/presentation.rb', line 121 def initialize @number_of_overlays = [] @title = 'unnamed slide' @content = '' @annotations = '' @style = '' yield self if block_given? end |
Instance Attribute Details
#annotations ⇒ Object
Returns the value of attribute annotations.
71 72 73 |
# File 'lib/wee-pm/presentation.rb', line 71 def annotations @annotations end |
#content ⇒ Object
the rdoc content of the slide (excluding the title)
70 71 72 |
# File 'lib/wee-pm/presentation.rb', line 70 def content @content end |
#converter ⇒ Object
Returns the value of attribute converter.
72 73 74 |
# File 'lib/wee-pm/presentation.rb', line 72 def converter @converter end |
#style ⇒ Object
Returns the value of attribute style.
73 74 75 |
# File 'lib/wee-pm/presentation.rb', line 73 def style @style end |
#title ⇒ Object
Returns the value of attribute title.
69 70 71 |
# File 'lib/wee-pm/presentation.rb', line 69 def title @title end |
Class Method Details
.from_string(str) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/wee-pm/presentation.rb', line 101 def self.from_string(str) new {|s| if str =~ /^=([^=].*)$/ str = $~.post_match s.title = $1.strip end if str =~ /^\w+::/ s.content = $~.pre_match if str =~ /^annotations::(.*)^endannotations::$/m s.annotations = $1.strip end if str =~ /^style::(.*)^endstyle::$/m s.style = $1.strip end else s.content = str end } end |
Instance Method Details
#number_of_overlays ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/wee-pm/presentation.rb', line 130 def if @content != @number_of_overlays[1] # content has changed -> re-calculate the number of overlays num = if @content.strip.empty? 0 else converter().new.(@content) end @number_of_overlays = [num, @content.dup] end @number_of_overlays[0] end |
#render_annotations_on(r) ⇒ Object
148 149 150 |
# File 'lib/wee-pm/presentation.rb', line 148 def render_annotations_on(r) converter().new.render_annotations_on(r, @annotations) end |
#render_on(r, overlay) ⇒ Object
144 145 146 |
# File 'lib/wee-pm/presentation.rb', line 144 def render_on(r, ) converter().new.render_on(r, , @content) end |
#to_s ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/wee-pm/presentation.rb', line 83 def to_s str = "= #{ @title }\n\n" + @content + "\n" unless @annotations.strip.empty? str << "annotations::\n" str << @annotations str << "\n" str << "endannotations::\n" end unless @style.strip.empty? str << "style::\n" str << @style str << "\n" str << "endstyle::\n" end str << "\n" str end |