Class: SlideHero::List

Inherits:
Object
  • Object
show all
Defined in:
lib/slide_hero/list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#styleObject (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

#compileObject



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

#pointsObject



28
29
30
# File 'lib/slide_hero/list.rb', line 28

def points
  @points ||= []
end