You're right, it does work if I add parentheses.
Still I don't fully understand why this is happening. The operator
obviously has a high presendence, because this of course does work:
p [1, 2, 3][0].to_s
Also this does work fine:
p (html/'/div')[0].to_html
I don't really see the difference to my second example. What am I
missing here?
Andreas
···
On Nov 17, 5:16 pm, yermej <yer...@gmail.com> wrote:
Try your second example in irb and you'll get a warning (or I do,
anyway):
(irb):5: warning: don't put space before argument parentheses
This means you're essentially doing this:
(p(item/'/div'))[0].to_html
and since p returns nil, you're calling on nil. Try this instead: