Sha256: 9600d12965356d5cb4782d5be11f64ac677f7e288591a7f7a7fca6a15bc4c122

Contents?: true

Size: 917 Bytes

Versions: 7

Compression:

Stored size: 917 Bytes

Contents

module XML
  module Smart

    class ProcessingInstruction
      def initialize(element)
        @node = element
      end

      def ===(cls); self.is_a? cls; end

      def dump; @node.to_s; end

      def replace_by(n)
        case n
          when ProcessingInstruction; ProcessingInstruction.new @node.replace(n.instance_variable_get(:@node))
          else
            nil
        end
      end

      def qname; QName.new @node; end

      def content; @node.content end
      def content=(t); @node.content = t.to_s if t.respond_to? :to_s; end

      def parent
        Dom::smart_helper(@node.parent)
      end
      def parent?; !@node.parent.nil?; end

      def path; @node.path; end

      def ==(other)
        return false unless other
        return false unless other.respond_to?(:unique_id)
        unique_id == other.unique_id
      end
      def unique_id; @node.pointer_id; end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
xml-smart-0.5.3 lib/xml/smart_processinginstruction.rb
xml-smart-0.5.2 lib/xml/smart_processinginstruction.rb
xml-smart-0.5.1 lib/xml/smart_processinginstruction.rb
xml-smart-0.5.0 lib/xml/smart_processinginstruction.rb
xml-smart-0.4.4 lib/xml/smart_processinginstruction.rb
xml-smart-0.4.3 lib/xml/smart_processinginstruction.rb
xml-smart-0.4.2 lib/xml/smart_processinginstruction.rb