Class: Ox::Instruct

Inherits:
Node
  • Object
show all
Includes:
HasAttrs
Defined in:
lib/ox/instruct.rb

Overview

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.

Instance Attribute Summary collapse

Attributes inherited from Node

#value

Instance Method Summary collapse

Methods included from HasAttrs

#[], #[]=, #attributes, #method_missing

Constructor Details

#initialize(name) ⇒ Instruct

Creates a new Instruct with the specified name.

  • name [String] name of the Instruct



16
17
18
19
20
# File 'lib/ox/instruct.rb', line 16

def initialize(name)
  super
  @attributes = nil
  @content = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ox::HasAttrs

Instance Attribute Details

#contentObject

The content of the processing instruction.



12
13
14
# File 'lib/ox/instruct.rb', line 12

def content
  @content
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

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.

  • other [Object] Object compare self to.

return [Boolean] true if both Objects are equivalent, otherwise false.

Returns:

  • (Boolean)


27
28
29
30
31
32
# File 'lib/ox/instruct.rb', line 27

def eql?(other)
  return false unless super(other)
  return false unless self.attributes == other.attributes
  return false unless self.content == other.content
  true
end