lib/slide_hero/presentation.rb in slide_hero-0.0.2 vs lib/slide_hero/presentation.rb in slide_hero-0.0.3

- old
+ new

@@ -3,10 +3,11 @@ require 'tilt' class Presentation attr_reader :title def initialize(title, &block) @title = title + @slide_defaults = {} instance_eval(&block) end def compile gem_path = Gem.loaded_specs['slide_hero'].full_gem_path @@ -15,15 +16,19 @@ render(self) do collected_slides end end + def defaults(args) + @slide_defaults = args + end + def slide(title, **kwargs, &slide_block) - slides << Slide.new(title, **kwargs, &slide_block).compile + slides << Slide.new(title, @slide_defaults.merge(**kwargs), &slide_block).compile end def grouped_slides(&block) - slides << GroupedSlides.new(&block).compile + slides << GroupedSlides.new(@slide_defaults, &block).compile end def collected_slides slides.join end