Class: GitHub::Markup::GemImplementation
- Inherits:
-
Implementation
- Object
- Implementation
- GitHub::Markup::GemImplementation
- Defined in:
- lib/github/markup/gem_implementation.rb
Instance Attribute Summary collapse
-
#gem_name ⇒ Object
readonly
Returns the value of attribute gem_name.
-
#renderer ⇒ Object
readonly
Returns the value of attribute renderer.
Attributes inherited from Implementation
Instance Method Summary collapse
-
#initialize(regexp, languages, gem_name, &renderer) ⇒ GemImplementation
constructor
A new instance of GemImplementation.
- #load ⇒ Object
- #name ⇒ Object
- #render(filename, content, options: {}) ⇒ Object
Methods inherited from Implementation
Constructor Details
#initialize(regexp, languages, gem_name, &renderer) ⇒ GemImplementation
Returns a new instance of GemImplementation.
8 9 10 11 12 |
# File 'lib/github/markup/gem_implementation.rb', line 8 def initialize(regexp, languages, gem_name, &renderer) super(regexp, languages) @gem_name = gem_name.to_s @renderer = renderer end |
Instance Attribute Details
#gem_name ⇒ Object (readonly)
Returns the value of attribute gem_name.
6 7 8 |
# File 'lib/github/markup/gem_implementation.rb', line 6 def gem_name @gem_name end |
#renderer ⇒ Object (readonly)
Returns the value of attribute renderer.
6 7 8 |
# File 'lib/github/markup/gem_implementation.rb', line 6 def renderer @renderer end |
Instance Method Details
#load ⇒ Object
14 15 16 17 18 |
# File 'lib/github/markup/gem_implementation.rb', line 14 def load return if defined?(@loaded) && @loaded require gem_name @loaded = true end |
#name ⇒ Object
25 26 27 |
# File 'lib/github/markup/gem_implementation.rb', line 25 def name gem_name end |
#render(filename, content, options: {}) ⇒ Object
20 21 22 23 |
# File 'lib/github/markup/gem_implementation.rb', line 20 def render(filename, content, options: {}) load renderer.call(filename, content, options: ) end |