File: instruct.rb

package info (click to toggle)
ruby-ox 2.1.1-2%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 540 kB
  • sloc: ansic: 7,178; ruby: 415; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 1,344 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

module Ox

  # An Instruct represents a processing instruction of an XML document. It has a target, attributes, and a value or
  # content. The content will be all characters with the exception of the target. If the content follows a regular
  # attribute format then the attributes will be set to the parsed values. If it does not follow the attribute formate
  # then the attributes will be empty.

  class Instruct < Node
    include HasAttrs

    # The content of the processing instruction.
    attr_accessor :content

    # Creates a new Instruct with the specified name.
    # @param [String] name name of the Instruct
    def initialize(name)
      super
      @attributes = nil
      @content = nil
    end
    alias target value
    
    # Returns true if this Object and other are of the same type and have the
    # equivalent value and the equivalent elements otherwise false is returned.
    # @param [Object] other Object compare _self_ to.
    # @return [Boolean] true if both Objects are equivalent, otherwise false.
    def eql?(other)
      return false if (other.nil? or self.class != other.class)
      return false unless super(other)
      return false unless self.attributes == other.attributes
      return false unless self.content == other.content
      true
    end
    alias == eql?
    
  end # Instruct
end # Ox