Class: Object

Inherits:
BasicObject
Defined in:
lib/attributable.rb

Overview

Object extension to provide the Class[] syntax for building objects, with Attributable module.

TODO : must be defined only for Class objects !!

Class Method Summary collapse

Class Method Details

.[](*args) ⇒ Object

operator [] definition for shorter and more recognizable object creation syntax.

Especially useful when creating Attributable dependant objects.

c = Circle[ :center, p, :radius, 0.1 ]


19
20
21
# File 'lib/attributable.rb', line 19

def Object.[](*args)
  return self.new( *args )
end