Module: CanTango::Registry::Clazz::InstanceMethods

Included in:
CanTango::Registry::Clazz
Defined in:
lib/cantango/registry/clazz.rb

Defined Under Namespace

Classes: ClassRegistry, NameRegistry

Instance Method Summary collapse

Instance Method Details

#<<(hash) ⇒ Object



15
16
17
18
19
20
# File 'lib/cantango/registry/clazz.rb', line 15

def << hash
  raise "Must be a hash" if !hash.is_a?(::Hash)
  hash.each_pair do |key, value|
    register key, value
  end
end

#class_registryObject



49
50
51
# File 'lib/cantango/registry/clazz.rb', line 49

def class_registry
  @class_registry ||= ClassRegistry.new
end

#clean!Object Also known as: clear!



27
28
29
30
# File 'lib/cantango/registry/clazz.rb', line 27

def clean!
  name_registry.clean!
  class_registry.clean!
end

#name_registryObject



45
46
47
# File 'lib/cantango/registry/clazz.rb', line 45

def name_registry
  @name_registry ||=NameRegistry.new
end

#register(label, value) ⇒ Object Also known as: []=



7
8
9
10
11
12
# File 'lib/cantango/registry/clazz.rb', line 7

def register label, value
  raise "first arg must be a label, was: #{label}" if !label.kind_of_label?
  raise "second arg must be a valid Class, was: #{value}" if !valid? value
  name_registry.register label.to_sym
  class_registry.register value
end

#registeredObject Also known as: registered_names



22
23
24
# File 'lib/cantango/registry/clazz.rb', line 22

def registered
  name_registry.registered
end

#registered?(name) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/cantango/registry/clazz.rb', line 37

def registered? name
  name_registry.registered? name
end

#registered_class?(name) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/cantango/registry/clazz.rb', line 41

def registered_class? name
  class_registry.registered? name
end

#registered_classesObject



33
34
35
# File 'lib/cantango/registry/clazz.rb', line 33

def registered_classes
  class_registry.registered
end

#value_methodsObject



53
54
55
# File 'lib/cantango/registry/clazz.rb', line 53

def value_methods
  class_registry.value_methods
end

#value_typesObject



57
58
59
# File 'lib/cantango/registry/clazz.rb', line 57

def value_types
  class_registry.types
end