From: "Eustáquio Rangel" Date: 2006-05-25T21:56:41+09:00 Subject: What's the main inside the block Hi there. I'm wondering what "main" inside a block means. For example: %w(one).each { puts self } => main What is exactly the "main" thing there? Btw, to make the block recognize the object instance context where it is running (on this case, the Array created with %w) the solution is using an instance_eval, as the instance_eval description says: "In order to set the context, the variable self is set to obj while the code is executing, giving the code access to obj's instance variables." Like: %w(one two three).instance_eval{ each_with_index {|v,i| puts "#{i+1}/#{self.size}=#{v}" } } => 1/3=one 2/3=two 3/3=three On this example, used for checking the size of the created object where the block is executing. Thanks! -- Posted via http://www.ruby-forum.com/.