Module: VacuumCleaner
- Defined in:
- lib/vacuum_cleaner.rb,
lib/vacuum_cleaner/railtie.rb,
lib/vacuum_cleaner/normalizer.rb,
lib/vacuum_cleaner/normalizations.rb,
lib/vacuum_cleaner/normalizations/url.rb,
lib/vacuum_cleaner/normalizations/method.rb,
lib/vacuum_cleaner/normalizations/numeric.rb,
lib/vacuum_cleaner/normalizations/active_support.rb
Overview
Defined Under Namespace
Modules: Normalizations Classes: Normalizer, Railtie
Constant Summary collapse
- VERSION =
VacuumCleanerversion "1.0.1".freeze
- WITHOUT_NORMALIZATION_SUFFIX =
Suffix added to existing setter methods
"_without_normalization"
Class Method Summary collapse
-
.camelize_value(value) ⇒ Object
Okay, because this library currently does not depend on
ActiveSupportor anything similar an “independent” camelizing process is required.
Class Method Details
.camelize_value(value) ⇒ Object
Okay, because this library currently does not depend on ActiveSupport or anything similar an “independent” camelizing process is required.
How it works: If value.to_s responds to :camelize, then call it else, use implementation taken from github.com/rails/rails/blob/master/activesupport/lib/active_support/inflector/methods.rb#L25
85 86 87 88 |
# File 'lib/vacuum_cleaner/normalizations.rb', line 85 def camelize_value(value) value = value.to_s value.respond_to?(:camelize) ? value.camelize : value.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } end |