Sha256: b3b6d7f04baa43af60cbef091e5eb8afaf676ed983cee258fe013992106f57ef

Contents?: true

Size: 498 Bytes

Versions: 13

Compression:

Stored size: 498 Bytes

Contents

require "github/markup/implementation"

module GitHub
  module Markup
    class GemImplementation < Implementation
      attr_reader :gem_name, :renderer

      def initialize(regexp, gem_name, &renderer)
        super regexp
        @gem_name = gem_name.to_s
        @renderer = renderer
      end

      def load
        return if @loaded
        require gem_name
        @loaded = true
      end

      def render(content)
        load
        renderer.call(content)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
github-markup-1.3.3 lib/github/markup/gem_implementation.rb
github-markup-1.3.2 lib/github/markup/gem_implementation.rb
github-markup-1.3.1 lib/github/markup/gem_implementation.rb
github-markup-1.3.0 lib/github/markup/gem_implementation.rb
github-markup-1.2.1 lib/github/markup/gem_implementation.rb
github-markup-1.2.0 lib/github/markup/gem_implementation.rb
github-markup-1.1.2 lib/github/markup/gem_implementation.rb
github-markup-1.1.1 lib/github/markup/gem_implementation.rb
github-markup-1.1.0 lib/github/markup/gem_implementation.rb
github-markup-1.0.3 lib/github/markup/gem_implementation.rb
github-markup-1.0.2 lib/github/markup/gem_implementation.rb
github-markup-1.0.1 lib/github/markup/gem_implementation.rb
github-markup-1.0.0 lib/github/markup/gem_implementation.rb