to_class_name(name) public

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"
Show source
Register or log in to add new notes.