Class: SlideHero::Presentation

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, &block) ⇒ Presentation

Returns a new instance of Presentation.



6
7
8
9
10
# File 'lib/slide_hero/presentation.rb', line 6

def initialize(title, &block)
  @title = title
  @slide_defaults = {}
  instance_eval(&block)
end

Instance Attribute Details

#slide_defaultsObject (readonly)

Returns the value of attribute slide_defaults.



5
6
7
# File 'lib/slide_hero/presentation.rb', line 5

def slide_defaults
  @slide_defaults
end

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'lib/slide_hero/presentation.rb', line 5

def title
  @title
end

Instance Method Details

#collected_slidesObject



60
61
62
# File 'lib/slide_hero/presentation.rb', line 60

def collected_slides
  slides.join
end

#compileObject



31
32
33
34
35
36
37
38
# File 'lib/slide_hero/presentation.rb', line 31

def compile
  set_plugins if plugins.empty?
  Tilt::ERBTemplate.new(File.join(SlideHero.template_path, 
                                  'lib/slide_hero/views/layout.html.erb')).
                                  render(self) do 
                                    collected_slides
                                  end
end

#defaults(args) ⇒ Object



40
41
42
# File 'lib/slide_hero/presentation.rb', line 40

def defaults(args)
  @slide_defaults = args
end

#grouped_slides(&block) ⇒ Object



56
57
58
# File 'lib/slide_hero/presentation.rb', line 56

def grouped_slides(&block)
  slides << GroupedSlides.new(slide_defaults, &block).compile
end

#pluginsObject



27
28
29
# File 'lib/slide_hero/presentation.rb', line 27

def plugins
  @plugins ||= ""
end

#set_plugins(*plugin_list) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/slide_hero/presentation.rb', line 12

def set_plugins(*plugin_list)
  if plugin_list.empty?
    defaults = %i{class_list highlight notes remote}
    plugin_list = defaults
  end

  plugin_list.each do |plugin|
    if Plugins.reveal_list.include? plugin
      plugins <<  "#{Plugins.reveal[plugin]},"
    end
  end

  plugins.chop
end

#set_theme(theme) ⇒ Object



48
49
50
# File 'lib/slide_hero/presentation.rb', line 48

def set_theme(theme)
  @theme = theme
end

#slide(title, **kwargs, &slide_block) ⇒ Object



52
53
54
# File 'lib/slide_hero/presentation.rb', line 52

def slide(title, **kwargs, &slide_block)
  slides << Slide.new(title, slide_defaults.merge(**kwargs), &slide_block).compile
end

#slidesObject



64
65
66
# File 'lib/slide_hero/presentation.rb', line 64

def slides
  @slides ||= []
end

#themeObject



44
45
46
# File 'lib/slide_hero/presentation.rb', line 44

def theme
  @theme ||= 'solarized'
end