From: Hassan Schroeder Date: 2010-11-14T01:27:25+09:00 Subject: Re: an each/block problem On Sat, Nov 13, 2010 at 8:08 AM, Paul Roche wrote: > Just one more thing. if I want to attach the 'name' of the User to that. > How can I do it? > > i.e so the print out is "User1: you can borrow more" Pass the entire User object, e.g. `borrowed.call(user)` and change your proc to: borrowed = lambda do |user| if user.books_borrowed > 1 then p "#{user.name}: you have borrowed too many" else puts "#{user.name}: you can borrow more" end end or have it take 2 arguments, user.name and user.books_borrowed, exercise left to the reader :-) HTH, -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com twitter: @hassan