From: Ja Tse Date: 2012-08-11T04:53:59+09:00 Subject: Re: Unable to print a block argument. Thanks, JAn I the concept was right but I didn't look close enough. I have modified it a little bit please see the snippet. Can you also tell me the name of this pattern as it us used a lot in Ruby, and what would be a good use case. Thanks ''' class Foo attr_accessor :name, :surname, :age def initialize( name, surname, age ) @name = name @surname = surname @age = age end def self.open(foo) x = new "foo", "bar", "buzz" block_given? ? yield(x) : x end def len @op.length end end Foo.open("this") do |o| puts o.name o.surname = "xxxx" puts o.surname puts o.age end -- Posted via http://www.ruby-forum.com/.