Class: Enterprisifier::Marshalling::XSD::Schema::Element

Inherits:
Object
  • Object
show all
Includes:
SchemaComposition, SchemaComposition::TypeDefSetting
Defined in:
lib/enterprisifier/marshalling/xsd/schema/element.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SchemaComposition::TypeDefSetting

#reify_self

Methods included from SchemaComposition

included

Constructor Details

#initialize(type_def = nil) ⇒ Element

<< self



35
36
37
38
# File 'lib/enterprisifier/marshalling/xsd/schema/element.rb', line 35

def initialize(type_def = nil)
  super
  set_type_def(type_def)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



18
19
20
# File 'lib/enterprisifier/marshalling/xsd/schema/element.rb', line 18

def name
  @name
end

Class Method Details

.implementation(&block) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/enterprisifier/marshalling/xsd/schema/element.rb', line 26

def implementation(&block)
  if block_given?
    reified.class_eval(&block)
  else
    reified
  end
end

.is_referable?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/enterprisifier/marshalling/xsd/schema/element.rb', line 22

def is_referable?
  true
end

Instance Method Details

#create(*args, &block) ⇒ Object



50
51
52
# File 'lib/enterprisifier/marshalling/xsd/schema/element.rb', line 50

def create(*args, &block)
  reified.create(*args, &block)
end

#reference?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/enterprisifier/marshalling/xsd/schema/element.rb', line 40

def reference?
  !!@reference
end

#reifiedObject

TODO:
  • uuuugly



56
57
58
59
60
61
62
# File 'lib/enterprisifier/marshalling/xsd/schema/element.rb', line 56

def reified
  return @reference.reified if reference? && @reference.respond_to?(:reified)
  @reified ||= Class.new(InstantiatableElement).tap do |inst|
    inst.element_name = name
    inst.element_namespace = namespace
  end
end

#reify(reifiable) ⇒ Object



44
45
46
47
48
# File 'lib/enterprisifier/marshalling/xsd/schema/element.rb', line 44

def reify(reifiable)
  super
  return @reference.reify(reifiable) if reference?
  many? ? reify_many(reifiable) : reify_one(reifiable)
end