Class: VectorSalad::ExportWithMagic

Inherits:
Object
  • Object
show all
Includes:
DSL, StandardShapes
Defined in:
lib/vector_salad/export_with_magic.rb

Instance Method Summary collapse

Methods included from DSL

#method_missing

Constructor Details

#initialize(options) ⇒ ExportWithMagic

Returns a new instance of ExportWithMagic.



13
14
15
16
# File 'lib/vector_salad/export_with_magic.rb', line 13

def initialize(options)
  @options = options
  @file = options.file
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class VectorSalad::DSL

Instance Method Details

#canvasObject



18
19
20
# File 'lib/vector_salad/export_with_magic.rb', line 18

def canvas
  @canvas ||= VectorSalad::Canvas.new
end

#exportObject



22
23
24
25
26
27
# File 'lib/vector_salad/export_with_magic.rb', line 22

def export
  data = File.read(@file)
  instance_eval(data, @file)
  @options.canvas = canvas
  Exporters::SvgExporter.new(@options).export
end