On Mon, Jun 2, 2014 at 12:20 PM, Ryan Davis <ryand-ruby / zenspider.com> wrote:
>
> On Jun 2, 2014, at 0:27, Robert Klemme <shortcutter / googlemail.com> wrote:
>
>> On Mon, Jun 2, 2014 at 6:55 AM, Ryan Davis <ryand-ruby / zenspider.com> wrote:

>>> Not true anymore:
>>
>> What is not true any more? You are just confirming what I wrote above.
>
> I read your statement to say that String#% doesn't handle hashes, tho on second reading you might have meant that it doesn't #hash. Not that I can figure out why you'd say such a thing. Arup's mail was pretty clear that he was using String#% with a hash argument.

Well, I read it differently but there you go.

> Not exactly your point. None of your examples of sprintf are like the last example of the String#% rdoc:
>
> "foo = %{foo}" % { :foo => 'bar' }
>
> returns:
>
> "foo = bar"
>
> So you were confusing the issue when the OP was clearly using a hash argument.

I was replying to the OP's question "Does it mean I can use String#%
to hash?"  You cannot use String#% to hash something - it's just a
formatting function.  I just did not provide examples for all use
cases.

Cheers

robert



-- 
[guy, jim].each {|him| remember.him do |as, often| as.you_can - without end}
http://blog.rubybestpractices.com/