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.

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

Parameters:

  • basename (String)
  • _abspath (String)

Returns:

  • (String)


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

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