The code written without additional class .. end, module .. end enclosures is executed directly, step by step, in context of special main object. This object can be referenced using:
2.2.2 :001 > self
# => main
Methods defined without additional classes/modules are defined as private methods of the main object, and, consequently, as private methods of almost any other object in Ruby:
2.2.2 :002 > def foo
2.2.2 :003?> 42
2.2.2 :004?> end
# => :foo
2.2.2 :005 > foo
# => 42
2.2.2 :006 > [].foo
# => NoMethodError: private method `foo' called for []:Array
2.2.2 :007 > [].send :foo
# => 42
Thus, in your code, main method (or it can any other method) is in the context of main object and so multiply method can be called from either ExampleClass.new or Array.new or from any other class.
Source: Wikipedia
UPDATE
Few notes from engineersmnky's comment.
This is not a private method in main but rather a private method of BasicObject (in 2.0-2.2).
As of 2.3 (and in 1.9.3) this method is not even privatized.
It need not be an instance of the class e.g. Class.new as the class itself will also have this method defined e.g. BasicObject.foo