Class: GitHub::Markup::CommandImplementation
- Inherits:
-
Implementation
- Object
- Implementation
- GitHub::Markup::CommandImplementation
- Defined in:
- lib/github/markup/command_implementation.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Implementation
Instance Method Summary collapse
-
#initialize(regexp, languages, command, name, &block) ⇒ CommandImplementation
constructor
A new instance of CommandImplementation.
- #render(filename, content, options: {}) ⇒ Object
Methods inherited from Implementation
Constructor Details
#initialize(regexp, languages, command, name, &block) ⇒ CommandImplementation
Returns a new instance of CommandImplementation.
13 14 15 16 17 18 |
# File 'lib/github/markup/command_implementation.rb', line 13 def initialize(regexp, languages, command, name, &block) super(regexp, languages) @command = command.to_s @block = block @name = name end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
11 12 13 |
# File 'lib/github/markup/command_implementation.rb', line 11 def block @block end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
11 12 13 |
# File 'lib/github/markup/command_implementation.rb', line 11 def command @command end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/github/markup/command_implementation.rb', line 11 def name @name end |
Instance Method Details
#render(filename, content, options: {}) ⇒ Object
20 21 22 23 24 |
# File 'lib/github/markup/command_implementation.rb', line 20 def render(filename, content, options: {}) rendered = execute(command, content) rendered = rendered.to_s.empty? ? content : rendered call_block(rendered, content) end |