Class: SVGPlot::Application
- Inherits:
-
Object
- Object
- SVGPlot::Application
- Defined in:
- lib/svgplot/application.rb
Overview
Application object for running .svgplot files
Instance Method Summary collapse
-
#initialize(*args) ⇒ Application
constructor
A new instance of Application.
- #run! ⇒ Object
Constructor Details
#initialize(*args) ⇒ Application
Returns a new instance of Application.
5 6 7 8 |
# File 'lib/svgplot/application.rb', line 5 def initialize(*args) @files = args.empty? ? Dir.glob(File.('*.svgplot')) : args fail('No input files') if @files.empty? end |
Instance Method Details
#run! ⇒ Object
10 11 12 13 14 15 |
# File 'lib/svgplot/application.rb', line 10 def run! @files.each do |file| output = file.sub(/\.svgplot/, '') + '.svg' File.open(output, 'w') { |fh| build file, fh } end end |