[ruby/date] Suppress warnings by gcc-13 with `-Og`
[ruby.git] / doc / syntax / operators.rdoc
blobd3045ac99e35b3119dfb62c8ece6268626389bd2
1 = Operators
3 In Ruby, operators such as <code>+</code>, are defined as methods on the class.
4 Literals[rdoc-ref:syntax/literals.rdoc] define their methods within the lower
5 level, C language. String class, for example.
7 Ruby objects can define or overload their own implementation for most operators.
9 Here is an example:
11   class Foo < String
12     def +(str)
13       self.concat(str).concat("another string")
14     end
15   end