Method: String#classify
- Defined in:
- lib/core/string.rb
#classify ⇒ Object
Turn a string from lowercased with a . to a classified classname rice_and_beans #=> “RiceAndBeans” handles subclassed and namespaced classes as well for instance
rice::and::beans #=> Rice::And::Beans
25 26 27 |
# File 'lib/core/string.rb', line 25 def classify self.sub(/.*\./, '').split("::").map {|ele| ele.camelcase }.join("::") end |