Sha256: 495fde721c0d3fac79cce3a07152cdd7368a2bbf63125201294b60e775630f5c

Contents?: true

Size: 790 Bytes

Versions: 11

Compression:

Stored size: 790 Bytes

Contents

module LibXML
  module XML
    class Schema::Type
      def kind_name
        Schema::Types.constants.find { |k| Schema::Types.const_get(k) == kind }
      end

      def annotation
        return if node.nil?
        annotations = node.children.select { |n| n.name == 'annotation' }
        annotations.map do |annotation|
          annotation.children.map(&:content).join("\n")
        end.join("\n")
      end

      def annonymus_subtypes
        elements.select { |_, e| e.type.name.nil? }
      end

      def annonymus_subtypes_recursively(parent=nil)
        annonymus_subtypes.map do |element_name, e|
          [{[parent, element_name].compact.join('::') => e.type},
           e.type.annonymus_subtypes_recursively(element_name)]
        end.flatten
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
libxml-ruby-2.9.0-x64-mingw32 lib/libxml/schema/type.rb
libxml-ruby-2.9.0 lib/libxml/schema/type.rb
libxml-ruby-2.8.0 lib/libxml/schema/type.rb
libxml-ruby-2.7.0-x86-mingw32 lib/libxml/schema/type.rb
libxml-ruby-2.7.0 lib/libxml/schema/type.rb
libxml-ruby-2.6.0-x86-mingw32 lib/libxml/schema/type.rb
libxml-ruby-2.6.0 lib/libxml/schema/type.rb
libxml-ruby-2.5.0-x86-mingw32 lib/libxml/schema/type.rb
libxml-ruby-2.5.0 lib/libxml/schema/type.rb
libxml-ruby-2.4.0-x86-mingw32 lib/libxml/schema/type.rb
libxml-ruby-2.4.0 lib/libxml/schema/type.rb