Class: SlideHero::Presentation
- Inherits:
-
Object
- Object
- SlideHero::Presentation
- Defined in:
- lib/slide_hero/presentation.rb
Instance Attribute Summary collapse
-
#slide_defaults ⇒ Object
readonly
Returns the value of attribute slide_defaults.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #collected_slides ⇒ Object
- #compile ⇒ Object
- #defaults(args) ⇒ Object
- #grouped_slides(&block) ⇒ Object
-
#initialize(title, &block) ⇒ Presentation
constructor
A new instance of Presentation.
- #plugins ⇒ Object
- #set_plugins(*plugin_list) ⇒ Object
- #set_theme(theme) ⇒ Object
- #slide(title, **kwargs, &slide_block) ⇒ Object
- #slides ⇒ Object
- #theme ⇒ Object
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_defaults ⇒ Object (readonly)
Returns the value of attribute slide_defaults.
5 6 7 |
# File 'lib/slide_hero/presentation.rb', line 5 def @slide_defaults end |
#title ⇒ Object (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_slides ⇒ Object
60 61 62 |
# File 'lib/slide_hero/presentation.rb', line 60 def .join end |
#compile ⇒ Object
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 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 (&block) << GroupedSlides.new(, &block).compile end |
#plugins ⇒ Object
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 (title, **kwargs, &) << Slide.new(title, .merge(**kwargs), &).compile end |
#slides ⇒ Object
64 65 66 |
# File 'lib/slide_hero/presentation.rb', line 64 def @slides ||= [] end |
#theme ⇒ Object
44 45 46 |
# File 'lib/slide_hero/presentation.rb', line 44 def theme @theme ||= 'solarized' end |