Class: Cayuga::Object::NamedObject
- Defined in:
- lib/cayuga/object/named_object.rb
Overview
Named Object
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Object
Class Method Summary collapse
- .create(factory, configuration, name) ⇒ Object
- .primary(name) ⇒ Object
- .primary?(_name) ⇒ Boolean
- .valid_name?(_factory, name) ⇒ Boolean
Methods included from Tools::Loggable
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/cayuga/object/named_object.rb', line 8 def name @name end |
Class Method Details
.create(factory, configuration, name) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cayuga/object/named_object.rb', line 22 def self.create(factory, configuration, name) raise "#{self.stringify}[#{name}] already registered" if factory.registered?(self, name) if primary?(name) primary = name alternate = nil else primary = primary(name) alternate = name end verify_name_validity(factory, primary, alternate) instance = create_primary(factory, configuration, primary(name)) factory.register(instance, self, alternate) unless alternate.nil? instance end |
.primary(name) ⇒ Object
18 19 20 |
# File 'lib/cayuga/object/named_object.rb', line 18 def self.primary(name) name end |
.primary?(_name) ⇒ Boolean
14 15 16 |
# File 'lib/cayuga/object/named_object.rb', line 14 def self.primary?(_name) true end |
.valid_name?(_factory, name) ⇒ Boolean
10 11 12 |
# File 'lib/cayuga/object/named_object.rb', line 10 def self.valid_name?(_factory, name) name != nil end |