Sha256: d0a7f34433a8503f5c73618ed5319b4907b07c5c8bc8520d725c3ee409cc5647

Contents?: true

Size: 588 Bytes

Versions: 8

Compression:

Stored size: 588 Bytes

Contents

module SlideHero
  class Point
    attr_reader :text
    SUPPORTED_ANIMATIONS = %w{grow shrink roll-in fade-out 
      highlight-red highlight-green highlight-blue}

    def initialize(text, animation: nil)
      @text = text
      @animation = animation
    end

    def compile
      "<p#{animation}>#{text}</p>"
    end

    private
    def animation
      if @animation
        animation_markup = ' class="fragment ' 
        if SUPPORTED_ANIMATIONS.include? @animation
          animation_markup << @animation 
        end
        animation_markup + "\""
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
slide_hero-0.0.9 lib/slide_hero/point.rb
slide_hero-0.0.8 lib/slide_hero/point.rb
slide_hero-0.0.7 lib/slide_hero/point.rb
slide_hero-0.0.6 lib/slide_hero/point.rb
slide_hero-0.0.5 lib/slide_hero/point.rb
slide_hero-0.0.4 lib/slide_hero/point.rb
slide_hero-0.0.3 lib/slide_hero/point.rb
slide_hero-0.0.2 lib/slide_hero/point.rb