Ruby can override existing classes and methods.
For example, consider Ruby's String class.
If you create a string, you end up with an object of class String; for example:
x = "This is a test" puts x.class
You can call a number of different methods upon the String object stored in x:
x = "This is a test" puts x.length puts x.upcase
You can override the length method of the String class:
class String def length # w w w . j a v a 2s. c o m 20 end end puts "This is a test".length puts "a".length puts "A really long line of text".length