------art_124905_25170119.1183507675229
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

>
> So if you *really* wanted to use blocks in your original example, you
> could do:
>
> def around_string(string, &block)
>      b, a  ield
>      "#{b}#{string}#{a}"
> end
>
> around_string('mystring') { ['before','after'] }
>
> But that is ugly and unidiomatic. :)



Is the &block parameter necessary? When is it necessary?

And so I take it with blocks, they are given a new reference to the objects
in question and therefore assigning to the variables in the block has no
effect on the method.  ie

def around_string(string, &block)
     b  il
     a  il
     yield(b,a)
     "#{b}#{string}#{a}"
end

around_string('center') { |b, a| b  left'; a  right' }

is worthless because in the block I'm merely assigning objects to local
references that go out of scope once the block exits?

Matt

------art_124905_25170119.1183507675229--