Class: Glossarist::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/glossarist/config.rb

Constant Summary collapse

DEFAULT_CLASSES =
{
  localized_concept: Glossarist::LocalizedConcept,
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



15
16
17
18
# File 'lib/glossarist/config.rb', line 15

def initialize
  @registered_classes = DEFAULT_CLASSES.dup
  @extension_attributes = []
end

Instance Attribute Details

#registered_classesObject (readonly)

Returns the value of attribute registered_classes.



13
14
15
# File 'lib/glossarist/config.rb', line 13

def registered_classes
  @registered_classes
end

Class Method Details

.class_for(name) ⇒ Object



37
38
39
# File 'lib/glossarist/config.rb', line 37

def class_for(name)
  self.instance.class_for(name)
end

.extension_attributesObject



41
42
43
# File 'lib/glossarist/config.rb', line 41

def extension_attributes
  self.instance.extension_attributes
end

.register_class(class_name, klass) ⇒ Object



45
46
47
# File 'lib/glossarist/config.rb', line 45

def register_class(class_name, klass)
  self.instance.register_class(class_name, klass)
end

.register_extension_attributes(attributes) ⇒ Object



49
50
51
# File 'lib/glossarist/config.rb', line 49

def register_extension_attributes(attributes)
  self.register_extension_attributes(attributes)
end

Instance Method Details

#class_for(name) ⇒ Object



20
21
22
# File 'lib/glossarist/config.rb', line 20

def class_for(name)
  @registered_classes[name.to_sym]
end

#extension_attributesObject



28
29
30
# File 'lib/glossarist/config.rb', line 28

def extension_attributes
  @extension_attributes
end

#register_class(class_name, klass) ⇒ Object



24
25
26
# File 'lib/glossarist/config.rb', line 24

def register_class(class_name, klass)
  @registered_classes[class_name] = klass
end

#register_extension_attributes(attributes) ⇒ Object



32
33
34
# File 'lib/glossarist/config.rb', line 32

def register_extension_attributes(attributes)
  @extension_attributes = attributes
end