Sha256: 09423a304f439b298298d9feff8111af707376e7602898eca88c40cabb892c9e

Contents?: true

Size: 741 Bytes

Versions: 17

Compression:

Stored size: 741 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, parent: self)
          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

17 entries across 17 versions & 1 rubygems

Version Path
junoser-0.6.0 lib/junoser/xsd/simple_content.rb
junoser-0.5.6 lib/junoser/xsd/simple_content.rb
junoser-0.5.5 lib/junoser/xsd/simple_content.rb
junoser-0.5.4 lib/junoser/xsd/simple_content.rb
junoser-0.5.3 lib/junoser/xsd/simple_content.rb
junoser-0.5.2 lib/junoser/xsd/simple_content.rb
junoser-0.5.1 lib/junoser/xsd/simple_content.rb
junoser-0.5.0 lib/junoser/xsd/simple_content.rb
junoser-0.4.7 lib/junoser/xsd/simple_content.rb
junoser-0.4.6 lib/junoser/xsd/simple_content.rb
junoser-0.4.5 lib/junoser/xsd/simple_content.rb
junoser-0.4.4 lib/junoser/xsd/simple_content.rb
junoser-0.4.3 lib/junoser/xsd/simple_content.rb
junoser-0.4.2 lib/junoser/xsd/simple_content.rb
junoser-0.4.1 lib/junoser/xsd/simple_content.rb
junoser-0.4.0 lib/junoser/xsd/simple_content.rb
junoser-0.3.13 lib/junoser/xsd/simple_content.rb