Module RSS::Utils
In: rss/utils.rb

Methods

Public Instance methods

[Source]

# File rss/utils.rb, line 33
    def element_initialize_arguments?(args)
      [true, false].include?(args[0]) and args[1].is_a?(Hash)
    end

[Source]

# File rss/utils.rb, line 12
    def get_file_and_line_from_caller(i=0)
      file, line, = caller[i].split(':')
      [file, line.to_i]
    end
h(s)

Alias for html_escape

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

[Source]

# File rss/utils.rb, line 18
    def html_escape(s)
      s.to_s.gsub(/&/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
    end

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

[Source]

# File rss/utils.rb, line 25
    def new_with_value_if_need(klass, value)
      if value.is_a?(klass)
        value
      else
        klass.new(value)
      end
    end

Convert a name_with_underscores to CamelCase.

[Source]

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

[Validate]

ruby-doc.org is hosted and maintained by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. The site was created in 2002 as part of the Ruby Documentation Project to promote the Ruby language and to help other Ruby hackers.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.