Class: Zeitwerk::Inflector

Inherits:
Object
  • Object
show all
Defined in:
lib/zeitwerk/inflector.rb

Overview

:nodoc:

Direct Known Subclasses

GemInflector

Instance Method Summary collapse

Instance Method Details

#camelize(basename, _abspath) ⇒ String

Very basic snake case -> camel case conversion.

Zeitwerk::Inflector.camelize("post", ...)             # => "Post"
Zeitwerk::Inflector.camelize("users_controller", ...) # => "UsersController"
Zeitwerk::Inflector.camelize("api", ...)              # => "Api"

Parameters:

  • basename (String)
  • _abspath (String)

Returns:

  • (String)


14
15
16
# File 'lib/zeitwerk/inflector.rb', line 14

def camelize(basename, _abspath)
  basename.split('_').map!(&:capitalize!).join
end