Class: NetworkDrawer::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/network_drawer/cli.rb

Overview

Cli for NetworkDrawer

Instance Method Summary collapse

Instance Method Details

#draw(source_file) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/network_drawer/cli.rb', line 15

def draw(source_file)
  src = Source.read(source_file)
  op = {}
  op = { style: Source.read(options[:style]) } if options[:style]
  op.merge!(layout: options[:layout])
  op.merge!(format: options[:format])
  dest_file = source_file.gsub(File.extname(source_file), '')
  Diagram.draw(src, dest_file, op)
end