Class: Nanoc::Graphviz::Filter

Inherits:
Filter
  • Object
show all
Defined in:
lib/nanoc/graphviz/filter.rb

Overview

Graphviz Filter class

Instance Method Summary collapse

Instance Method Details

#ready?Boolean

check runtime envs

Returns:

  • (Boolean)


28
29
30
# File 'lib/nanoc/graphviz/filter.rb', line 28

def ready?
  graphviz_ready?
end

#run(content, _ = {}) ⇒ Integer

convert Graphviz code to image

Parameters:

  • content (String)

    Graphviz code

Returns:

  • (Integer)

    command process status

Raises:

  • (RuntimeError)


18
19
20
21
22
23
# File 'lib/nanoc/graphviz/filter.rb', line 18

def run(content, _ = {})
  fail 'Runtime environments is not ready' unless ready?
  command = "dot -Tpng -o #{output_filename} < #{content}"
  system(command)
  $?
end