Module: ScaffoldParser::Scaffolders::XSD::Parser::Handlers::OrderElements

Included in:
Choice, Elements, Sequence
Defined in:
lib/scaffold_parser/scaffolders/xsd/parser/handlers/order_elements.rb

Instance Method Summary collapse

Instance Method Details

#all(_) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/order_elements.rb', line 20

def all(_)
  flattened = elements.flat_map do |element|
    case element
    when Sequence, Choice, All
      element.elements
    else
      element
    end
  end

  All.new flattened
end

#choice(_) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/order_elements.rb', line 33

def choice(_)
  flattened = elements.flat_map do |element|
    case element
    when Sequence, Choice, All
      element.elements
    else
      element
    end
  end

  Choice.new flattened
end

#sequence(_) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/order_elements.rb', line 7

def sequence(_)
  flattened = elements.flat_map do |element|
    case element
    when Sequence, Choice, All
      element.elements
    else
      element
    end
  end

  Sequence.new flattened
end