class GitHub::Markup::Implementation

Attributes

languages[R]
regexp[R]

Public Class Methods

new(regexp, languages) click to toggle source
# File lib/github/markup/implementation.rb, line 7
def initialize(regexp, languages)
  @regexp = regexp

  if defined?(::Linguist)
    @languages = languages.map {|l| Linguist::Language[l]}
  end
end

Public Instance Methods

load() click to toggle source
# File lib/github/markup/implementation.rb, line 15
def load
  # no-op by default
end
match?(filename, language) click to toggle source
# File lib/github/markup/implementation.rb, line 23
def match?(filename, language)
  if defined?(::Linguist)
    languages.include? language
  else
    file_ext_regexp =~ filename
  end
end
render(filename, content) click to toggle source
# File lib/github/markup/implementation.rb, line 19
def render(filename, content)
  raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render"
end