Sha256: 6efc37d0d68e40abc215b53558d635dfeaf18cb44a0024d4e14b3a60688d87b8

Contents?: true

Size: 1.99 KB

Versions: 2

Compression:

Stored size: 1.99 KB

Contents

# $Id: libxml.rb 374 2008-07-11 04:51:41Z cfis $ 
# Please see the LICENSE file for copyright and distribution information 

module LibXML
  module XML
    class AttrDecl
      include Enumerable

      # call-seq:
      #   attr_decl.child -> nil
      #
      # Obtain this attribute declaration's child attribute(s).
      # It will always be nil.
      def child
        nil
      end

      # call-seq:
      #    attr_decl.child? -> (true|false)
      #
      # Returns whether this attribute declaration has child attributes.
      #
      def child?
        not self.children.nil?
      end

      # call-seq:
      #    attr_decl.doc? -> (true|false)
      #
      # Determine whether this attribute declaration is associated with an
      # XML::Document.
      def doc?
        not self.doc.nil?
      end

      # call-seq:
      #    attr_decl.next? -> (true|false)
      #
      # Determine whether there is a next attribute declaration.
      def next?
        not self.next.nil?
      end

      # call-seq:
      #    attr_decl.parent? -> (true|false)
      #
      # Determine whether this attribute declaration has a parent .
      def parent?
        not self.parent.nil?
      end

      # call-seq:
      #    attr_decl.prev? -> (true|false)
      #
      # Determine whether there is a previous attribute declaration.
      def prev?
        not self.prev.nil?
      end

      # call-seq:
      #    attr_decl.node_type_name -> 'attribute declaration'
      #
      # Returns this attribute declaration's node type name.
      def node_type_name
        if node_type == Node::ATTRIBUTE_DECL
          'attribute declaration'
        else
          raise(UnknownType, "Unknown node type: %n", node.node_type);
        end
      end

      # call-seq:
      #    attr_decl.to_s -> string
      #
      # Returns a string representation of this attribute declaration.
      def to_s
        "#{name} = #{value}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
libxml-ruby-0.9.8 lib/libxml/attr_decl.rb
libxml-ruby-0.9.8-x86-mswin32-60 lib/libxml/attr_decl.rb