Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby27/share/ruby/rss
File: xml.rb
# frozen_string_literal: false
[0] Fix | Delete
require_relative "utils"
[1] Fix | Delete
[2] Fix | Delete
module RSS
[3] Fix | Delete
module XML
[4] Fix | Delete
class Element
[5] Fix | Delete
include Enumerable
[6] Fix | Delete
[7] Fix | Delete
attr_reader :name, :prefix, :uri, :attributes, :children
[8] Fix | Delete
def initialize(name, prefix=nil, uri=nil, attributes={}, children=[])
[9] Fix | Delete
@name = name
[10] Fix | Delete
@prefix = prefix
[11] Fix | Delete
@uri = uri
[12] Fix | Delete
@attributes = attributes
[13] Fix | Delete
if children.is_a?(String) or !children.respond_to?(:each)
[14] Fix | Delete
@children = [children]
[15] Fix | Delete
else
[16] Fix | Delete
@children = children
[17] Fix | Delete
end
[18] Fix | Delete
end
[19] Fix | Delete
[20] Fix | Delete
def [](name)
[21] Fix | Delete
@attributes[name]
[22] Fix | Delete
end
[23] Fix | Delete
[24] Fix | Delete
def []=(name, value)
[25] Fix | Delete
@attributes[name] = value
[26] Fix | Delete
end
[27] Fix | Delete
[28] Fix | Delete
def <<(child)
[29] Fix | Delete
@children << child
[30] Fix | Delete
end
[31] Fix | Delete
[32] Fix | Delete
def each(&block)
[33] Fix | Delete
@children.each(&block)
[34] Fix | Delete
end
[35] Fix | Delete
[36] Fix | Delete
def ==(other)
[37] Fix | Delete
other.kind_of?(self.class) and
[38] Fix | Delete
@name == other.name and
[39] Fix | Delete
@uri == other.uri and
[40] Fix | Delete
@attributes == other.attributes and
[41] Fix | Delete
@children == other.children
[42] Fix | Delete
end
[43] Fix | Delete
[44] Fix | Delete
def to_s
[45] Fix | Delete
rv = "<#{full_name}"
[46] Fix | Delete
attributes.each do |key, value|
[47] Fix | Delete
rv << " #{Utils.html_escape(key)}=\"#{Utils.html_escape(value)}\""
[48] Fix | Delete
end
[49] Fix | Delete
if children.empty?
[50] Fix | Delete
rv << "/>"
[51] Fix | Delete
else
[52] Fix | Delete
rv << ">"
[53] Fix | Delete
children.each do |child|
[54] Fix | Delete
rv << child.to_s
[55] Fix | Delete
end
[56] Fix | Delete
rv << "</#{full_name}>"
[57] Fix | Delete
end
[58] Fix | Delete
rv
[59] Fix | Delete
end
[60] Fix | Delete
[61] Fix | Delete
def full_name
[62] Fix | Delete
if @prefix
[63] Fix | Delete
"#{@prefix}:#{@name}"
[64] Fix | Delete
else
[65] Fix | Delete
@name
[66] Fix | Delete
end
[67] Fix | Delete
end
[68] Fix | Delete
end
[69] Fix | Delete
end
[70] Fix | Delete
end
[71] Fix | Delete
[72] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function