PHP 8.2.31
Preview: instruction.rb Size: 2.01 KB
//proc/thread-self/root/opt/alt/ruby21/lib64/ruby/2.1.0/rexml/instruction.rb

require "rexml/child"
require "rexml/source"

module REXML
  # Represents an XML Instruction; IE, <? ... ?>
  # TODO: Add parent arg (3rd arg) to constructor
  class Instruction < Child
    START = '<\?'
    STOP = '\?>'

    # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
    # content is everything else.
    attr_accessor :target, :content

    # Constructs a new Instruction
    # @param target can be one of a number of things.  If String, then
    # the target of this instruction is set to this.  If an Instruction,
    # then the Instruction is shallowly cloned (target and content are
    # copied).  If a Source, then the source is scanned and parsed for
    # an Instruction declaration.
    # @param content Must be either a String, or a Parent.  Can only
    # be a Parent if the target argument is a Source.  Otherwise, this
    # String is set as the content of this instruction.
    def initialize(target, content=nil)
      if target.kind_of? String
        super()
        @target = target
        @content = content
      elsif target.kind_of? Instruction
        super(content)
        @target = target.target
        @content = target.content
      end
      @content.strip! if @content
    end

    def clone
      Instruction.new self
    end

    # == DEPRECATED
    # See the rexml/formatters package
    #
    def write writer, indent=-1, transitive=false, ie_hack=false
      Kernel.warn( "#{self.class.name}.write is deprecated" )
      indent(writer, indent)
      writer << START.sub(/\\/u, '')
      writer << @target
      writer << ' '
      writer << @content
      writer << STOP.sub(/\\/u, '')
    end

    # @return true if other is an Instruction, and the content and target
    # of the other matches the target and content of this object.
    def ==( other )
      other.kind_of? Instruction and
      other.target == @target and
      other.content == @content
    end

    def node_type
      :processing_instruction
    end

    def inspect
      "<?p-i #{target} ...?>"
    end
  end
end

Directory Contents

Dirs: 5 × Files: 30

Name Size Perms Modified Actions
dtd DIR
- drwxr-xr-x 2024-03-03 22:43:05
Edit Download
- drwxr-xr-x 2024-03-03 22:43:05
Edit Download
light DIR
- drwxr-xr-x 2024-03-03 22:43:05
Edit Download
parsers DIR
- drwxr-xr-x 2024-03-03 22:43:05
Edit Download
- drwxr-xr-x 2024-03-03 22:43:05
Edit Download
1.89 KB lrw-r--r-- 2009-10-02 10:45:39
Edit Download
5.50 KB lrw-r--r-- 2013-08-04 18:37:46
Edit Download
1.54 KB lrw-r--r-- 2011-05-19 00:07:25
Edit Download
2.63 KB lrw-r--r-- 2011-05-19 00:07:25
Edit Download
2.14 KB lrw-r--r-- 2011-05-19 00:07:25
Edit Download
6.58 KB lrw-r--r-- 2010-12-07 12:10:23
Edit Download
9.48 KB lrw-r--r-- 2014-11-13 13:36:20
Edit Download
43.65 KB lrw-r--r-- 2013-04-26 13:56:34
Edit Download
1.13 KB lrw-r--r-- 2012-11-06 00:49:57
Edit Download
5.53 KB lrw-r--r-- 2014-11-13 13:36:20
Edit Download
11.27 KB lrw-r--r-- 2011-05-13 17:54:22
Edit Download
2.01 KB lrw-r--r-- 2009-10-02 10:45:39
Edit Download
1.09 KB lrw-r--r-- 2009-10-02 10:45:39
Edit Download
2.13 KB lrw-r--r-- 2011-05-19 00:07:25
Edit Download
519 B lrw-r--r-- 2012-11-03 05:43:28
Edit Download
4.33 KB lrw-r--r-- 2010-01-31 06:55:06
Edit Download
1.22 KB lrw-r--r-- 2010-10-30 12:10:56
Edit Download
9.08 KB lrw-r--r-- 2011-05-19 00:07:25
Edit Download
1.29 KB lrw-r--r-- 2013-02-27 12:24:31
Edit Download
3.58 KB lrw-r--r-- 2013-08-11 10:08:05
Edit Download
793 B lrw-r--r-- 2013-02-27 12:24:31
Edit Download
7.60 KB lrw-r--r-- 2012-11-06 00:49:57
Edit Download
3.81 KB lrw-r--r-- 2013-07-22 23:15:15
Edit Download
685 B lrw-r--r-- 2009-10-02 10:45:39
Edit Download
13.74 KB lrw-r--r-- 2013-07-07 02:50:38
Edit Download
210 B lrw-r--r-- 2007-11-16 01:30:29
Edit Download
2.68 KB lrw-r--r-- 2012-11-03 05:44:31
Edit Download
526 B lrw-r--r-- 2010-04-05 21:08:12
Edit Download
3.31 KB lrw-r--r-- 2011-05-18 21:19:18
Edit Download
25.70 KB lrw-r--r-- 2011-05-11 22:56:13
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).