Class: CrystalScad::CrystalScadObject
- Inherits:
-
Object
- Object
- CrystalScad::CrystalScadObject
show all
- Defined in:
- lib/crystalscad/CrystalScadObject.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CrystalScadObject.
5
6
7
8
9
10
11
|
# File 'lib/crystalscad/CrystalScadObject.rb', line 5
def initialize(*args)
@transformations = []
@args = args.flatten
if @args[0].kind_of? Hash
@args = @args[0]
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
44
45
|
# File 'lib/crystalscad/CrystalScadObject.rb', line 44
def method_missing(meth, *args, &block)
end
|
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
3
4
5
|
# File 'lib/crystalscad/CrystalScadObject.rb', line 3
def args
@args
end
|
Returns the value of attribute transformations.
4
5
6
|
# File 'lib/crystalscad/CrystalScadObject.rb', line 4
def transformations
@transformations
end
|
Instance Method Details
#save(filename, start_text = nil) ⇒ Object
37
38
39
40
41
42
|
# File 'lib/crystalscad/CrystalScadObject.rb', line 37
def save(filename,start_text=nil)
file = File.open(filename,"w")
file.puts start_text unless start_text == nil
file.puts scad_output
file.close
end
|
#to_rubyscad ⇒ Object
33
34
35
|
# File 'lib/crystalscad/CrystalScadObject.rb', line 33
def to_rubyscad
""
end
|
#walk_tree ⇒ Object
Also known as:
scad_output
13
14
15
16
17
18
19
20
21
|
# File 'lib/crystalscad/CrystalScadObject.rb', line 13
def walk_tree
res = ""
@transformations.reverse.each{|trans|
res += trans.walk_tree
}
res += self.to_rubyscad.to_s+ "\n"
res
end
|
#walk_tree_classes ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/crystalscad/CrystalScadObject.rb', line 24
def walk_tree_classes
res = []
@transformations.reverse.each{|trans|
res += trans.walk_tree_classes
}
res << self.class
res
end
|