Class: Zeitwerk::Inflector
- Inherits:
-
Object
- Object
- Zeitwerk::Inflector
- Defined in:
- lib/zeitwerk/inflector.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Method Summary collapse
-
#camelize(basename, _abspath) ⇒ String
Very basic snake case -> camel case conversion.
Instance Method Details
#camelize(basename, _abspath) ⇒ String
Very basic snake case -> camel case conversion.
inflector = Zeitwerk::Inflector.new
inflector.camelize("post", ...) # => "Post"
inflector.camelize("users_controller", ...) # => "UsersController"
inflector.camelize("api", ...) # => "Api"
15 16 17 |
# File 'lib/zeitwerk/inflector.rb', line 15 def camelize(basename, _abspath) basename.split('_').map!(&:capitalize).join end |