Class: YNelson::Dimension
- Inherits:
-
Object
- Object
- YNelson::Dimension
- Defined in:
- lib/y_nelson/dimension.rb
Overview
Zz dimension can in principle be any object, in YNelson, special class Dimension is used.
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Class Method Summary collapse
- .__new__ ⇒ Object
-
.instances ⇒ Object
Presents class-owned instances (array).
-
.new(*args) ⇒ Object
The #new constructor is changed, so that same instance is returned for same constructor arguments.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Dimension
constructor
Simply assigns array of arguments to @object atrribute.
-
#to_s ⇒ Object
Short instance description string.
Constructor Details
#initialize(*args) ⇒ Dimension
Simply assigns array of arguments to @object atrribute.
29 30 31 |
# File 'lib/y_nelson/dimension.rb', line 29 def initialize *args @object = args end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
25 26 27 |
# File 'lib/y_nelson/dimension.rb', line 25 def object @object end |
Class Method Details
.__new__ ⇒ Object
8 |
# File 'lib/y_nelson/dimension.rb', line 8 alias __new__ new |
.instances ⇒ Object
Presents class-owned instances (array).
12 13 14 |
# File 'lib/y_nelson/dimension.rb', line 12 def instances return @instances ||= [] end |
.new(*args) ⇒ Object
The #new constructor is changed, so that same instance is returned for same constructor arguments.
19 20 21 22 |
# File 'lib/y_nelson/dimension.rb', line 19 def new *args instances.find { | |
Instance Method Details
#to_s ⇒ Object
Short instance description string.
35 36 37 |
# File 'lib/y_nelson/dimension.rb', line 35 def to_s "#<YNelson::Dimension [#{object.join ', '}]>" end |