From: "markbuckingham@..." Date: 2008-08-02T12:04:01+09:00 Subject: Ruby block: why doesn't this work? I'm trying to figure out why my code isn't doing what I think it should... Basically, I'm trying to create a Info object, and do various things to that new object within the block. For what ever reason though, it doesn't look like the code inside the block is getting executed at all. (I'm trying to do something that looks kind of like activerecord's create_table method.) So... with the print statements in the code, I'd expect to see output from the address() and city() methods, but only the initialize method prints anything. (I can even put complete nonsense in the address or city methods, and nothing happens.) What am I doing wrong? Thanks! class Info attr_accessor :name, :address, :city def initialize(name) @name = name print "name: #{name}\n" end def address(value) @address = value print "address: #{address}\n" end def city(value) @city = value print "city: #{city}\n" end end def info(name) Info.new(name) end info :Bob do |i| i.address "123 Main St." i.city "Boston, MA" end