Class: Cayuga::Object::NamedObject

Inherits:
Object
  • Object
show all
Defined in:
lib/cayuga/object/named_object.rb

Overview

Named Object

Instance Attribute Summary collapse

Attributes inherited from Object

#configuration_name

Class Method Summary collapse

Methods included from Tools::Loggable

included

Instance Attribute Details

#nameObject (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

Returns:

  • (Boolean)

14
15
16
# File 'lib/cayuga/object/named_object.rb', line 14

def self.primary?(_name)
  true
end

.valid_name?(_factory, name) ⇒ Boolean

Returns:

  • (Boolean)

10
11
12
# File 'lib/cayuga/object/named_object.rb', line 10

def self.valid_name?(_factory, name)
  name != nil
end