Class: Nexmo::Markdown::Filters::CodeSnippet::Run

Inherits:
Object
  • Object
show all
Includes:
Renderable
Defined in:
lib/nexmo_markdown_renderer/filters/code_snippet/run.rb

Instance Method Summary collapse

Methods included from Renderable

#client_url, #id, #normalized_language, #renderer

Constructor Details

#initialize(config, snippet) ⇒ Run

Returns a new instance of Run.



8
9
10
11
# File 'lib/nexmo_markdown_renderer/filters/code_snippet/run.rb', line 8

def initialize(config, snippet)
  @config  = config
  @snippet = snippet
end

Instance Method Details

#renderObject



21
22
23
# File 'lib/nexmo_markdown_renderer/filters/code_snippet/run.rb', line 21

def render
  renderer.run_command(run_command, file_name, @config['code']['source']).to_s
end

#run_commandObject



13
14
15
16
17
18
19
# File 'lib/nexmo_markdown_renderer/filters/code_snippet/run.rb', line 13

def run_command
  @run_command ||= begin
    if @config['run_command']
      @config['run_command'].gsub('{filename}', file_name)
    end
  end
end