File: implementation.rb

package info (click to toggle)
ruby-gitlab-markup 1.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 504 kB
  • sloc: ruby: 369; python: 137; sh: 16; makefile: 15
file content (28 lines) | stat: -rw-r--r-- 526 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module GitHub
  module Markup
    class Implementation
      attr_reader :regexp

      def initialize(regexp)
        @regexp = regexp
      end

      def load
        # no-op by default
      end

      def render(content)
        raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render"
      end

      def match?(filename)
        file_ext_regexp =~ filename
      end

    private
      def file_ext_regexp
        @file_ext_regexp ||= /\.(#{regexp})\z/
      end
    end
  end
end