Sha256: 44830419b1f3bb34c33b7dd499c7327fea602fa907c9da8cfae1da7ae479fe40
Contents?: true
Size: 718 Bytes
Versions: 1
Compression:
Stored size: 718 Bytes
Contents
# frozen_string_literal: true module Zeitwerk class Inflector # :nodoc: # Given a basename without extension, returns the name of the constant # expected to be defined in such file or directory. # # Zeitwerk::Inflector.camelize("post", ...) # => "Post" # Zeitwerk::Inflector.camelize("users_controller", ...) # => "UsersController" # Zeitwerk::Inflector.camelize("api", ...) # => "Api" # Zeitwerk::Inflector.camelize("HTML", ...) # => "HTML" # # @param basename [String] # @param _abspath [String] # @return [String] def camelize(basename, _abspath) basename.gsub(/(?:\A|_)(\w)/) { $1.capitalize } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zeitwerk-1.0.0.alpha | lib/zeitwerk/inflector.rb |