Class: Architect::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/architect/runner.rb

Overview

Draws a diagram from a file

Instance Method Summary collapse

Constructor Details

#initialize(file, ext) ⇒ Runner

Returns a new instance of Runner.



8
9
10
11
12
13
# File 'lib/architect/runner.rb', line 8

def initialize(file, ext)
  @drawer = Architect::Diagram.new()
  diagram = Kernel.open(file).read()
  output_file = change_extension(file, ext)
  @drawer.draw(diagram, output_file)
end

Instance Method Details

#change_extension(file, new_ext) ⇒ Object



15
16
17
18
# File 'lib/architect/runner.rb', line 15

def change_extension(file, new_ext)
  ext = File.extname(file).gsub(".","")
  return file.gsub(ext, new_ext)
end