Class: VectorSalad::StandardShapes::Custom

Inherits:
BasicShape
  • Object
show all
Defined in:
lib/vector_salad/standard_shapes/custom.rb

Instance Attribute Summary

Attributes inherited from BasicShape

#options

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ Custom

Returns a new instance of Custom.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vector_salad/standard_shapes/custom.rb', line 9

def initialize(name, &block)
  #instance_eval(&block)
  ::VectorSalad::StandardShapes.const_set(name.to_s.capitalize.to_sym, Class.new(BasicShape) do
    include VectorSalad::DSL
    include VectorSalad::StandardShapes

    define_method(:initialize, &block)

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

    def to_path
      canvas[0]
    end
  end)
end