Class: Dsl::Graph::ExportGraph

Inherits:
Object
  • Object
show all
Defined in:
lib/dsl/graph/export.rb

Instance Method Summary collapse

Constructor Details

#initialize(graph, filename) ⇒ ExportGraph

Returns a new instance of ExportGraph.



7
8
9
10
# File 'lib/dsl/graph/export.rb', line 7

def initialize(graph, filename)
  @graph = graph
  @filename = filename
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/dsl/graph/export.rb', line 12

def call
  ext = File.extname(@filename.downcase)

  case ext
  when ".pdf"
    export_to_pdf
  when ".yaml", ".yml"
    export_to_yaml
  else
    warn "[ERROR] Unkown export format: (#{ext})"
    exit 1
  end
end