Class: SolidRuby::Transformations::Mirror

Inherits:
Transformation show all
Defined in:
lib/solidruby/transformations/mirror.rb

Instance Attribute Summary collapse

Attributes inherited from Transformation

#args

Instance Method Summary collapse

Methods inherited from Transformation

#walk_tree

Constructor Details

#initialize(*args) ⇒ Mirror

Returns a new instance of Mirror.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/solidruby/transformations/mirror.rb', line 20

def initialize(*args)
  if args.first.is_a? Hash
    args = args.first
    @x = args[:x]
    @y = args[:y]
    @z = args[:z]
  else
    args = [args].flatten
    @x = args.include?(:x) ? 1 : nil
    @y = args.include?(:y) ? 1 : nil
    @z = args.include?(:z) ? 1 : nil

    args = {x: @x, y: @y, z: @z}
  end

  super(args)
end

Instance Attribute Details

#xObject

Returns the value of attribute x.



18
19
20
# File 'lib/solidruby/transformations/mirror.rb', line 18

def x
  @x
end

#yObject

Returns the value of attribute y.



18
19
20
# File 'lib/solidruby/transformations/mirror.rb', line 18

def y
  @y
end

#zObject

Returns the value of attribute z.



18
19
20
# File 'lib/solidruby/transformations/mirror.rb', line 18

def z
  @z
end

Instance Method Details

#to_rubyscadObject



38
39
40
# File 'lib/solidruby/transformations/mirror.rb', line 38

def to_rubyscad
  RubyScadBridge.new.mirror(@args)
end