Sha256: 2b41683981001d6df963c26754d31f9c0ce401829bc0cb8e38acb8815a731a61

Contents?: true

Size: 636 Bytes

Versions: 12

Compression:

Stored size: 636 Bytes

Contents

require "github/markup/implementation"

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

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

      def load
        return if defined?(@loaded) && @loaded
        require gem_name
        @loaded = true
      end

      def render(filename, content, options: {})
        load
        renderer.call(filename, content, options: options)
      end

      def name
        gem_name
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/github-markup-5.0.1/lib/github/markup/gem_implementation.rb
github-markup-5.0.1 lib/github/markup/gem_implementation.rb
github-markup-5.0.0 lib/github/markup/gem_implementation.rb
github-markup-4.0.2 lib/github/markup/gem_implementation.rb
github-markup-4.0.1 lib/github/markup/gem_implementation.rb
github-markup-4.0.0 lib/github/markup/gem_implementation.rb
github-markup-3.0.5 lib/github/markup/gem_implementation.rb
github-markup-3.0.4 lib/github/markup/gem_implementation.rb
github-markup-3.0.3 lib/github/markup/gem_implementation.rb
github-markup-3.0.2 lib/github/markup/gem_implementation.rb
github-markup-3.0.1 lib/github/markup/gem_implementation.rb
github-markup-3.0.0 lib/github/markup/gem_implementation.rb