prater's blog

in which i hold forth upon various and sundry issues of import to persons employed in the production of software and am promptly and roundly ignored

Stupid Ruby Tricks
18 October 2016

1] pry(main)> a = { foo: 'bar' }
{
    :foo => "bar"
}
[2] pry(main)> a * 2
NoMethodError: undefined method `*' for {:foo=>"bar"}:Hash
from (pry):3:in `__pry__'
[3] pry(main)> [a] * 2
[
    [0] {
        :foo => "bar"
    },
    [1] {
        :foo => "bar"
    }
]
[4] pry(main)>