/opt/cpanel/ea-ruby27/root/usr/share/ruby/ruby-2.7.8/rss
NameSizeModeActions
content/-0755rm
dublincore/-0755rm
maker/-0755rm
0.9.rb108700644editdlrm
1.0.rb98720644editdlrm
2.0.rb35100644editdlrm
atom.rb296010644editdlrm
content.rb8950644editdlrm
converter.rb39960644editdlrm
dublincore.rb44170644editdlrm
image.rb49130644editdlrm
itunes.rb107340644editdlrm
maker.rb18890644editdlrm
parser.rb165760644editdlrm
rexmlparser.rb9950644editdlrm
rss.rb356240644editdlrm
slash.rb13600644editdlrm
syndication.rb19280644editdlrm
taxonomy.rb32760644editdlrm
trackback.rb68770644editdlrm
utils.rb52570644editdlrm
version.rb660644editdlrm
xml-stylesheet.rb22150644editdlrm
xml.rb15390644editdlrm
xmlparser.rb16900644editdlrm
xmlscanner.rb21850644editdlrm
Edit: /opt/cpanel/ea-ruby27/root/usr/share/ruby/ruby-2.7.8/rss/utils.rb (5257B)
# frozen_string_literal: false module RSS ## # RSS::Utils is a module that holds various utility functions that are used # across many parts of the rest of the RSS library. Like most modules named # some variant of 'util', its methods are probably not particularly useful # to those who aren't developing the library itself. module Utils module_function # Given a +name+ in a name_with_underscores or a name-with-dashes format, # returns the CamelCase version of +name+. # # If the +name+ is already CamelCased, nothing happens. # # Examples: # # require 'rss/utils' # # RSS::Utils.to_class_name("sample_name") # # => "SampleName" # RSS::Utils.to_class_name("with-dashes") # # => "WithDashes" # RSS::Utils.to_class_name("CamelCase") # # => "CamelCase" def to_class_name(name) name.split(/[_\-]/).collect do |part| "#{part[0, 1].upcase}#{part[1..-1]}" end.join("") end # Returns an array of two elements: the filename where the calling method # is located, and the line number where it is defined. # # Takes an optional argument +i+, which specifies how many callers up the # stack to look. # # Examples: # # require 'rss/utils' # # def foo # p RSS::Utils.get_file_and_line_from_caller # p RSS::Utils.get_file_and_line_from_caller(1) # end # # def bar # foo # end # # def baz # bar # end # # baz # # => ["test.rb", 5] # # => ["test.rb", 9] # # If +i+ is not given, or is the default value of 0, it attempts to figure # out the correct value. This is useful when in combination with # instance_eval. For example: # # require 'rss/utils' # # def foo # p RSS::Utils.get_file_and_line_from_caller(1) # end # # def bar # foo # end # # instance_eval <<-RUBY, *RSS::Utils.get_file_and_line_from_caller # def baz # bar # end # RUBY # # baz # # # => ["test.rb", 8] def get_file_and_line_from_caller(i=0) file, line, = caller[i].split(':') line = line.to_i line += 1 if i.zero? [file, line] end # Takes a string +s+ with some HTML in it, and escapes '&', '"', '<' and '>', by # replacing them with the appropriate entities. # # This method is also aliased to h, for convenience. # # Examples: # # require 'rss/utils' # # RSS::Utils.html_escape("Dungeons & Dragons") # # => "Dungeons & Dragons" # RSS::Utils.h(">_>") # # => ">_>" def html_escape(s) s.to_s.gsub(/&/, "&").gsub(/\"/, """).gsub(/>/, ">").gsub(/