From: "Jan E." Date: 2012-11-09T20:01:20+09:00 Subject: Re: A problem involving each and arrays Hi, the method stumbles upon the ['write'] entries being in myblock. A possible workaround would be: ... if myblock[i].any?{|c| c.class.to_s == "String"} newblock.push([myblock[i]]) else next if myblock[i][0] == ['write'] # <--- newblock.push([costhingy*myblock[i][0] ...]) end ... But I haven't gone through the whole code, so I have no idea if there are deeper issues. Apart from that, I think the main problem is that you didn't structure the code. This makes it hard to understand and very error-prone. Some parts also look strange and overly complicated (e. g. all the "for ... in" loops that are completely useless in ruby). So unless this is supposed to be just a quick hack, it might be a good idea to start from scratch and make a clean design. For example, how about defining classes for a canvas, a line and a shape (group of lines)? The canvas receives lines and shapes and generates the output file. And a shape is for grouping lines and transforming them (shift, rotate etc.). Something like that: canvas = Canvas.new line = Line.new x: 3, y: 2, z: 4 canvas << line line.move x: 12 output = canvas.generate_data You see? It's much clearer than a bunch of loops and array stuff, because you can actually *see* what happens. Custom shapes like a plane or a block could then simply be created by copying and transforming lines. -- Posted via http://www.ruby-forum.com/.