Class: ScaffoldParser::Scaffolders::XSD::Parser::Handlers::Blank

Inherits:
Object
  • Object
show all
Defined in:
lib/scaffold_parser/scaffolders/xsd/parser/handlers/blank.rb

Instance Method Summary collapse

Instance Method Details

#complex_type(source) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/blank.rb', line 38

def complex_type(source)
  if source.has_name?
    STACK.push Klass.new(source)
  else
    ComplexType.new
  end
end

#element(source) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/blank.rb', line 11

def element(source)
  if source.multiple?
    if elements.any?
      new_class = STACK.push Klass.new(source, elements)

      ListMethod.new(source) do |template|
        template.item_class = new_class.name.classify
      end
    else
      ListMethod.new(source) do |template|
        template.item_class = source.has_custom_type? ? source.type.split(':').map(&:classify).join('::') : 'String'
      end
    end
  elsif source.has_custom_type?
    SubmodelMethod.new(source)
  elsif source.has_ref?
    ElementRef.new(source)
  else
    if elements.any?
      new_class = STACK.push Klass.new(source, elements)
      SubmodelMethod.new(source, new_class.name_with_prefix)
    else
      AtMethod.new(source)
    end
  end
end

#elementsObject



7
8
9
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/blank.rb', line 7

def elements
  []
end

#extension(source) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/blank.rb', line 46

def extension(source)
  if source.custom_extension?
    Extension.new(elements, source.attributes)
  else # basic xsd extension
    self
  end
end

#group(source) ⇒ Object



66
67
68
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/blank.rb', line 66

def group(source)
  ModuleInclude.new(source)
end

#import(_) ⇒ Object



58
59
60
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/blank.rb', line 58

def import(_)
  Import.new
end

#include(_) ⇒ Object



54
55
56
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/blank.rb', line 54

def include(_)
  Include.new
end

#schema(_) ⇒ Object



62
63
64
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/blank.rb', line 62

def schema(_)
  STACK
end

#sequence(_) ⇒ Object



70
71
72
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/blank.rb', line 70

def sequence(_)
  self
end