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.
Attributes inherited from Implementation
Instance Method Summary collapse
-
#initialize(regexp, command, &block) ⇒ CommandImplementation
constructor
A new instance of CommandImplementation.
- #render(content) ⇒ Object
Methods inherited from Implementation
Constructor Details
#initialize(regexp, command, &block) ⇒ CommandImplementation
Returns a new instance of CommandImplementation.
14 15 16 17 18 |
# File 'lib/github/markup/command_implementation.rb', line 14 def initialize(regexp, command, &block) super regexp @command = command.to_s @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
12 13 14 |
# File 'lib/github/markup/command_implementation.rb', line 12 def block @block end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
12 13 14 |
# File 'lib/github/markup/command_implementation.rb', line 12 def command @command end |
Instance Method Details
#render(content) ⇒ Object
20 21 22 23 24 |
# File 'lib/github/markup/command_implementation.rb', line 20 def render(content) rendered = execute(command, content) rendered = rendered.to_s.empty? ? content : rendered call_block(rendered, content) end |