Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/jenncad/patches/array.rb
Instance Method Summary collapse
-
#assemble(partlib = nil, skip_z = false, z = 0) ⇒ Object
Assembles things on top of each other.
- #hull ⇒ Object (also: #h)
- #intersection ⇒ Object (also: #intersect, #i)
- #random ⇒ Object
- #subtraction ⇒ Object (also: #subtract, #sub, #s)
- #union ⇒ Object (also: #u)
Instance Method Details
#assemble(partlib = nil, skip_z = false, z = 0) ⇒ Object
Assembles things on top of each other
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/jenncad/patches/array.rb', line 3 def assemble(partlib=nil, skip_z=false, z=0) map do |part| case part when Array res = part.assemble(partlib, true) when String, Symbol res = partlib[part].yield when Proc res = part.yield else res = part end res, z = res.mz(z), z + res.z.to_d unless skip_z res end .union end |
#hull ⇒ Object Also known as: h
39 40 41 |
# File 'lib/jenncad/patches/array.rb', line 39 def hull HullObject.new(self) end |
#intersection ⇒ Object Also known as: intersect, i
33 34 35 |
# File 'lib/jenncad/patches/array.rb', line 33 def intersection IntersectionObject.new(self) end |
#random ⇒ Object
45 46 47 |
# File 'lib/jenncad/patches/array.rb', line 45 def random self[Random.rand(size)] end |
#subtraction ⇒ Object Also known as: subtract, sub, s
26 27 28 |
# File 'lib/jenncad/patches/array.rb', line 26 def subtraction SubtractObject.new(self) end |
#union ⇒ Object Also known as: u
21 22 23 |
# File 'lib/jenncad/patches/array.rb', line 21 def union UnionObject.new(self) end |