Maintenance of Ruby 2.0.0 will end on February 24, 2016. Read more

In Files

  • rss/utils.rb

Class/Module Index [+]



Public Instance Methods

element_initialize_arguments?(args) click to toggle source
               # File rss/utils.rb, line 35
def element_initialize_arguments?(args)
  [true, false].include?(args[0]) and args[1].is_a?(Hash)
get_file_and_line_from_caller(i=0) click to toggle source
               # File rss/utils.rb, line 12
def get_file_and_line_from_caller(i=0)
  file, line, = caller[i].split(':')
  line = line.to_i
  line += 1 if
  [file, line]
h(s) click to toggle source
Alias for: html_escape
html_escape(s) click to toggle source

escape ‘&’, ‘“’, ‘<’ and ‘>’ for use in HTML.

               # File rss/utils.rb, line 20
def html_escape(s)
  s.to_s.gsub(/&/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
Also aliased as: h
new_with_value_if_need(klass, value) click to toggle source

If value is an instance of class klass, return it, else create a new instance of klass with value value.

               # File rss/utils.rb, line 27
def new_with_value_if_need(klass, value)
  if value.is_a?(klass)
to_class_name(name) click to toggle source

Convert a name_with_underscores to CamelCase.

               # File rss/utils.rb, line 6
def to_class_name(name)
  name.split(/[_\-]/).collect do |part|
    "#{part[0, 1].upcase}#{part[1..-1]}"

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit

blog comments powered by Disqus