Class: GitHub::Markup::CommandImplementation

Inherits:
Implementation show all
Defined in:
lib/github/markup/command_implementation.rb

Constant Summary collapse

DEFAULT_GITLAB_MARKUP_TIMEOUT =
'10'.freeze

Instance Attribute Summary collapse

Attributes inherited from Implementation

#regexp

Instance Method Summary collapse

Methods inherited from Implementation

#load, #match?

Constructor Details

#initialize(regexp, command, name, &block) ⇒ CommandImplementation

Returns a new instance of CommandImplementation.



19
20
21
22
23
24
# File 'lib/github/markup/command_implementation.rb', line 19

def initialize(regexp, command, name, &block)
  super regexp
  @command = command.to_s
  @block = block
  @name = name
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



17
18
19
# File 'lib/github/markup/command_implementation.rb', line 17

def block
  @block
end

#commandObject (readonly)

Returns the value of attribute command.



17
18
19
# File 'lib/github/markup/command_implementation.rb', line 17

def command
  @command
end

#nameObject (readonly)

Returns the value of attribute name.



17
18
19
# File 'lib/github/markup/command_implementation.rb', line 17

def name
  @name
end

Instance Method Details

#render(content) ⇒ Object



26
27
28
29
30
# File 'lib/github/markup/command_implementation.rb', line 26

def render(content)
  rendered = execute(command, content)
  rendered = rendered.to_s.empty? ? content : rendered
  call_block(rendered, content)
end