In Ruby you can do a + b
, which is equivalent to a.+(b)
.
You can also override the +()
method with def +(other); end
.
Is there an alternate syntax for backticks? I know that this works:
class Foo
def `(message)
puts '<' + message + '>'
end
def bar
`hello world`
end
end
Foo.new.bar # prints "<hello world>"
But this won't work e.g.
Foo.new.`hello world`