From: gabriele renzi Date: 2004-11-15T04:58:26+09:00 Subject: Re: I guess "obj.attr = arg" methods don't allow blocks... (maybe rcr?) Sam Roberts ha scritto: > Does this conflict with some kind of basic rule in the grammer? > > Could it be an RCR, or is just wrong-headed? :-) > > I want to assign into an object, but I want to take a proc as an arg, so > that the assignment can be "paramaterized" in some sense, like; > > # Usually: > card.email = "user@example.com" > > # Sometimes: > card.email = "user@example.com" do |e| > e.type = 'preferred' > e.protocol = 'uucp' > e.location = 'work' > end > > It doesn't seem to be allowed, I did a quick test: I don't know what's going on, but I'd ask: why don't you use an Email class and write: card.email = Email.new('user@foo') {block} it seem much more clean to me..