Sha256: 69498ea094a2b0e2086221ef1fc26e2de8c51cd8bca12cf44940977587ea1765

Contents?: true

Size: 489 Bytes

Versions: 2

Compression:

Stored size: 489 Bytes

Contents

module XsdModel
  module Elements
    class Element
      include BaseElement

      def max_occurs
        value = attributes['maxOccurs']

        case value
        when 'unbounded'
          then Float::INFINITY
        when String
          then value.to_i
        when nil
          then 1
        end
      end

      def multiple?
        max_occurs > 1
      end

      def has_ref?
        !ref.nil?
      end

      def ref
        attributes['ref']
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xsd_model-0.7.0 lib/xsd_model/elements/element.rb
xsd_model-0.6.0 lib/xsd_model/elements/element.rb