KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm wondering why calls to operator methods don't require a dot? Or rather, why can't normal methods be called without a dot? Example class Foo def +(object) puts "this will work" end def plus(object) puts "this won't" end end f = Foo.new f + "anything" # "this will work" f plus "anything" # NoMethodError: undefined method `plus' for main:Object
Tags (comma-separated)
Save Edits
Cancel