Class: SlideHero::List
- Inherits:
-
Object
- Object
- SlideHero::List
- Defined in:
- lib/slide_hero/list.rb
Instance Attribute Summary collapse
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Instance Method Summary collapse
- #compile ⇒ Object
-
#initialize(style = :unordered, &block) ⇒ List
constructor
A new instance of List.
- #list(style = :unordered, &block) ⇒ Object
- #point(text, animation: nil) ⇒ Object
- #points ⇒ Object
Constructor Details
#initialize(style = :unordered, &block) ⇒ List
Returns a new instance of List.
5 6 7 8 |
# File 'lib/slide_hero/list.rb', line 5 def initialize(style=:unordered, &block) @style = style instance_eval(&block) end |
Instance Attribute Details
#style ⇒ Object (readonly)
Returns the value of attribute style.
3 4 5 |
# File 'lib/slide_hero/list.rb', line 3 def style @style end |
Instance Method Details
#compile ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/slide_hero/list.rb', line 10 def compile if style == :unordered Tilt::ERBTemplate.new(File.join(SlideHero.template_path, 'lib/slide_hero/views/unordered_list.html.erb')).render(self) else Tilt::ERBTemplate.new(File.join(SlideHero.template_path, 'lib/slide_hero/views/ordered_list.html.erb')).render(self) end end |
#list(style = :unordered, &block) ⇒ Object
24 25 26 |
# File 'lib/slide_hero/list.rb', line 24 def list(style=:unordered, &block) points << List.new(style, &block).compile end |
#point(text, animation: nil) ⇒ Object
20 21 22 |
# File 'lib/slide_hero/list.rb', line 20 def point(text, animation: nil) points << ListPoint.new(text, { animation: animation }) end |
#points ⇒ Object
28 29 30 |
# File 'lib/slide_hero/list.rb', line 28 def points @points ||= [] end |