Class: Sekken::XS

Inherits:
Object
  • Object
show all
Defined in:
lib/sekken/xs/types.rb,
lib/sekken/xs/schema.rb,
lib/sekken/xs/schema_collection.rb

Defined Under Namespace

Classes: All, Annotation, AnyType, Attribute, AttributeGroup, BaseType, Choice, ComplexContent, ComplexType, Element, Enumeration, Extension, PrimaryType, Restriction, Schema, SchemaCollection, Sequence, SimpleContent, SimpleType

Constant Summary collapse

TYPE_MAPPING =
{
  'attribute'      => Attribute,
  'attributeGroup' => AttributeGroup,
  'element'        => Element,
  'complexType'    => ComplexType,
  'simpleType'     => SimpleType,
  'simpleContent'  => SimpleContent,
  'complexContent' => ComplexContent,
  'extension'      => Extension,
  'restriction'    => Restriction,
  'all'            => All,
  'sequence'       => Sequence,
  'choice'         => Choice,
  'enumeration'    => Enumeration,
  'annotation'     => Annotation
}

Class Method Summary collapse

Class Method Details

.build(node, schemas, schema = {}) ⇒ Object



252
253
254
# File 'lib/sekken/xs/types.rb', line 252

def self.build(node, schemas, schema = {})
  type_class(node).new(node, schemas, schema)
end

.loggerObject



267
268
269
# File 'lib/sekken/xs/types.rb', line 267

def self.logger
  @logger ||= Logging.logger[self]
end

.type_class(node) ⇒ Object



256
257
258
259
260
261
262
263
264
265
# File 'lib/sekken/xs/types.rb', line 256

def self.type_class(node)
  type = node.name.split(':').last

  if TYPE_MAPPING.include? type
    TYPE_MAPPING[type]
  else
    logger.debug("No type mapping for #{type.inspect}. ")
    AnyType
  end
end