all repos — markup @ b7cabb1c81ea30035dd63a508a67a949c1846f4c

The code we use to render README.your_favorite_markup

lib/github/markup/gem_implementation.rb (view raw)

 1require "github/markup/implementation"
 2
 3module GitHub
 4  module Markup
 5    class GemImplementation < Implementation
 6      attr_reader :gem_name, :renderer
 7
 8      def initialize(regexp, gem_name, &renderer)
 9        super regexp
10        @gem_name = gem_name.to_s
11        @renderer = renderer
12      end
13
14      def load
15        return if @loaded
16        require gem_name
17        @loaded = true
18      end
19
20      def render(content)
21        load
22        renderer.call(content)
23      end
24    end
25  end
26end