Sha256: 41571cad9087ea2ced4cb396f81f5c7f5285aab3fcfbf9407f0e7e5e063370a6

Contents?: true

Size: 547 Bytes

Versions: 3

Compression:

Stored size: 547 Bytes

Contents

require "github/markup/implementation"

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

      def initialize(languages, gem_name, &renderer)
        super languages
        @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

      def name
        gem_name
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
github-markup-1.4.8 lib/github/markup/gem_implementation.rb
github-markup-1.4.7 lib/github/markup/gem_implementation.rb
github-markup-1.4.6 lib/github/markup/gem_implementation.rb