Class: DBA::Diagram
Constant Summary collapse
- PRINTERS =
{ '.dbml' => :DBMLPrinter, '.dot' => :DOTPrinter, '.gv' => :DOTPrinter, '.pu' => :PlantUMLPrinter, '.puml' => :PlantUMLPrinter, }
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
Constructor Details
This class inherits a constructor from DBA::Command
Instance Method Details
#call(path = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dba/diagram.rb', line 12 def call(path = nil) if path.nil? printer = DBA::DOTPrinter.new printer.print_diagram(database) else extension = File.extname(path) printer = PRINTERS.fetch(extension) { raise DBA::Error, 'unsupported file extension' } printer = DBA.const_get(printer) File.open(path, 'w+') do |file| printer = printer.new(file) printer.print_diagram(database) end end end |