Module: Autoloaded::Inflection Private
- Defined in:
- lib/autoloaded/inflection.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Translates source filenames into constants.
Class Method Summary collapse
-
.to_constant_name(source_filename) ⇒ Symbol
private
Translates a String representing a source filename into a Symbol representing a constant.
Class Method Details
.to_constant_name(source_filename) ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Note:
Directories are ignored rather than translated into namespaces.
Translates a String representing a source filename into a Symbol representing a constant.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/autoloaded/inflection.rb', line 18 def self.to_constant_name(source_filename) source_filename = source_filename.to_s raise(::ArgumentError, "can't be blank") if source_filename.empty? translate(source_filename, *[:file_basename, :camelize_if_lowercase, :nonalphanumeric_to_underscore, :delete_leading_nonalphabetic, :capitalize_first]).to_sym end |