Sha256: de8f85988bf809b1b983503860513a31c45a144c671349dfcfa43765dc2f5c24

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

module ScaffoldParser
  module Scaffolders
    class XSD
      class Parser
        module Handlers
          module OrderElements
            def sequence(_)
              flattened = elements.flat_map do |element|
                case element
                when Sequence, Choice, All
                  element.elements
                else
                  element
                end
              end

              Sequence.new flattened
            end

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

              All.new flattened
            end

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

              Choice.new flattened
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scaffold_parser-0.10.0 lib/scaffold_parser/scaffolders/xsd/parser/handlers/order_elements.rb
scaffold_parser-0.9.1 lib/scaffold_parser/scaffolders/xsd/parser/handlers/order_elements.rb
scaffold_parser-0.9.0 lib/scaffold_parser/scaffolders/xsd/parser/handlers/order_elements.rb
scaffold_parser-0.8.0 lib/scaffold_parser/scaffolders/xsd/parser/handlers/order_elements.rb
scaffold_parser-0.7.0 lib/scaffold_parser/scaffolders/xsd/parser/handlers/order_elements.rb