Module: AwesomeLoader::Utils
- Defined in:
- lib/awesome_loader/utils.rb
Overview
Misc utilities.
Constant Summary collapse
- SNAKE =
Regex to match "snake name" paths
%r{_([a-z])}- LEADING_SEP =
%r{^/}- TRAILING_SEP =
%r{/$}
Class Method Summary collapse
-
.camelize(name) ⇒ String
Converts a snake_case_name to a CamelCaseName.
-
.clean_path(path) ⇒ String
Returns the path with any leading or trailing /'s removed.
Class Method Details
.camelize(name) ⇒ String
Converts a snake_case_name to a CamelCaseName.
17 18 19 |
# File 'lib/awesome_loader/utils.rb', line 17 def self.camelize(name) name.capitalize.gsub(SNAKE) { |match| match[1].capitalize } end |
.clean_path(path) ⇒ String
Returns the path with any leading or trailing /'s removed.
27 28 29 |
# File 'lib/awesome_loader/utils.rb', line 27 def self.clean_path(path) path.sub(LEADING_SEP, '').sub(TRAILING_SEP, '') end |