Sha256: 8f24172b066b87065c5589faf079528f91ef1709e5b96f19aa771276d1fc0a3b

Contents?: true

Size: 789 Bytes

Versions: 2

Compression:

Stored size: 789 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).strip
      else
        Tilt::ERBTemplate.new(
        File.join(SlideHero.template_path, 'lib/slide_hero/views/ordered_list.html.erb')).
        render(self).strip
      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

2 entries across 2 versions & 1 rubygems

Version Path
slide_hero-0.0.11 lib/slide_hero/list.rb
slide_hero-0.0.10 lib/slide_hero/list.rb