Sha256: bd3226ead3b6a17f44b7673289f7b01282893ee6efcdfa55d3f5a5900d7a7755
Contents?: true
Size: 809 Bytes
Versions: 2
Compression:
Stored size: 809 Bytes
Contents
module GitHub module Markup class Implementation attr_reader :regexp attr_reader :languages def initialize(regexp, languages) @regexp = regexp if defined?(::Linguist) @languages = languages.map {|l| Linguist::Language[l]} end end def load # no-op by default end def render(filename, content, options: {}) raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render" end def match?(filename, language) if defined?(::Linguist) languages.include? language else file_ext_regexp =~ filename end end private def file_ext_regexp @file_ext_regexp ||= /\.(#{regexp})\z/ end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
github-markup-3.0.1 | lib/github/markup/implementation.rb |
github-markup-3.0.0 | lib/github/markup/implementation.rb |