Niyazi Toytok wrote:
>
> Hello all,
> I'm learning ruby recently and one thing makes me think. is it possible to
> pass more than one block to methods? also is it necessary or is there need
> for that?
>

Not in the sense of xyz {|a| ...} {|b| ...} but I've had the
occasional need to yield more than once from the same method.

Like:

def xyz
  val = 'build :a'
  yield [1, val]
  val = 'build :b'
  yield [2, val]
  nil
end

xyz do |i, arg|
  case i
   when 1
     # stuff #
     puts arg
   when 2
     puts "do something with #{arg}"
     # stuff #
  end
end

#-> build :a
#-> do something with build :b


Flexible enough ?

daz