Class: GitHub::Markup::Implementation
- Inherits:
-
Object
- Object
- GitHub::Markup::Implementation
show all
- Defined in:
- lib/github/markup/implementation.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(regexp, languages) ⇒ Implementation
7
8
9
10
11
12
13
|
# 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
|
Instance Attribute Details
#languages ⇒ Object
Returns the value of attribute languages.
5
6
7
|
# File 'lib/github/markup/implementation.rb', line 5
def languages
@languages
end
|
#regexp ⇒ Object
Returns the value of attribute regexp.
4
5
6
|
# File 'lib/github/markup/implementation.rb', line 4
def regexp
@regexp
end
|
Instance Method Details
#load ⇒ Object
15
16
17
|
# File 'lib/github/markup/implementation.rb', line 15
def load
end
|
#match?(filename, language) ⇒ Boolean
23
24
25
26
27
28
29
|
# 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) ⇒ Object
19
20
21
|
# File 'lib/github/markup/implementation.rb', line 19
def render(filename, content)
raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render"
end
|