Sha256: beaf8bf0b066e7db3faa5809f71f3e15b2630d1481ab494324a09bcb5b1cd0a7

Contents?: true

Size: 824 Bytes

Versions: 6

Compression:

Stored size: 824 Bytes

Contents

module SlideHero
  class List
    attr_reader :style

    def initialize(style=:unordered, &block)
      @style = style 
      instance_eval(&block)
    end

    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

    def point(text, animation: nil)
      points << ListPoint.new(text, { animation: animation })
    end

    def list(style=:unordered, &block)
      points << List.new(style, &block).compile
    end

    def points
      @points ||= []
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slide_hero-0.0.9 lib/slide_hero/list.rb
slide_hero-0.0.8 lib/slide_hero/list.rb
slide_hero-0.0.7 lib/slide_hero/list.rb
slide_hero-0.0.6 lib/slide_hero/list.rb
slide_hero-0.0.5 lib/slide_hero/list.rb
slide_hero-0.0.4 lib/slide_hero/list.rb