Module: Enterprisifier::Schema::ElementFactory
- Defined in:
- lib/enterprisifier/schema/element_factory.rb
Defined Under Namespace
Classes: MissingElementError
Class Method Summary
collapse
Class Method Details
.create_element(name, attributes, namespaces) ⇒ Object
8
9
10
|
# File 'lib/enterprisifier/schema/element_factory.rb', line 8
def self.create_element(name, attributes, namespaces)
get_element_class(name).new(attributes, namespaces)
end
|
.get_element_class(element_name) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/enterprisifier/schema/element_factory.rb', line 16
def self.get_element_class(element_name)
if klass = @registered_elements[element_name.to_s]
klass
else
Logger.warn("Unhandled element: #{element_name}")
Enterprisifier::Schema::Elements::UnknownElement
end
end
|
.register(element_name, klass) ⇒ Object
12
13
14
|
# File 'lib/enterprisifier/schema/element_factory.rb', line 12
def self.register(element_name, klass)
@registered_elements[element_name.to_s] = klass
end
|