Sha256: 61bece2e14bd2843b2323820ce1d76fb46d4c5d12dea17d2b8f911d7a5ba220d

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 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

2 entries across 2 versions & 1 rubygems

Version Path
libxml-ruby-3.0.0-x64-mingw32 lib/libxml/schema/type.rb
libxml-ruby-3.0.0 lib/libxml/schema/type.rb