Sha256: 5d5d359af4fe92621bfab1cc64c68948aca578d5ad3b797722736179927617f6

Contents?: true

Size: 727 Bytes

Versions: 24

Compression:

Stored size: 727 Bytes

Contents

require 'junoser/xsd/base'
require 'junoser/xsd/restriction'

module Junoser
  module Xsd
    class SimpleContent
      include Base

      def config
        @config ||= children.map {|child|
          case child.name
          when 'restriction'
            Junoser::Xsd::Restriction.new(child, depth: @depth+1)
          when 'extension'
            'arg'
          else
            raise "ERROR: unknown element: #{child.name}"
          end
        }
      end

      def to_s
        return if config.empty?
        raise "ERROR: simpleContent shouldn't have multiple children" if config.size > 1

        child = config.first
        child.is_a?(String) ? format(OFFSET + child) : child.to_s
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
junoser-0.3.12 lib/junoser/xsd/simple_content.rb
junoser-0.3.11 lib/junoser/xsd/simple_content.rb
junoser-0.3.10 lib/junoser/xsd/simple_content.rb
junoser-0.3.9 lib/junoser/xsd/simple_content.rb
junoser-0.3.8 lib/junoser/xsd/simple_content.rb
junoser-0.3.7 lib/junoser/xsd/simple_content.rb
junoser-0.3.6 lib/junoser/xsd/simple_content.rb
junoser-0.3.5 lib/junoser/xsd/simple_content.rb
junoser-0.3.4 lib/junoser/xsd/simple_content.rb
junoser-0.3.3 lib/junoser/xsd/simple_content.rb
junoser-0.3.2 lib/junoser/xsd/simple_content.rb
junoser-0.3.1 lib/junoser/xsd/simple_content.rb
junoser-0.3.0 lib/junoser/xsd/simple_content.rb
junoser-0.2.13 lib/junoser/xsd/simple_content.rb
junoser-0.2.12 lib/junoser/xsd/simple_content.rb
junoser-0.2.11 lib/junoser/xsd/simple_content.rb
junoser-0.2.10 lib/junoser/xsd/simple_content.rb
junoser-0.2.9 lib/junoser/xsd/simple_content.rb
junoser-0.2.8 lib/junoser/xsd/simple_content.rb
junoser-0.2.7 lib/junoser/xsd/simple_content.rb