Module: FastCamelize
- Defined in:
- lib/fast_camelize.rb,
lib/fast_camelize/version.rb,
ext/fast_camelize/fast_camelize.c
Overview
By default, FastCamelize already defines String#camelize and FastCamelize::camelize. In the case that we’re using ActiveSupport, however, there is the additional functionality of defined acronyms that we need to account for. In this case, we’re going to first allow ActiveSupport to do that work, then we’re going to do the actual camelization.
Defined Under Namespace
Modules: ActiveSupportDelayedPatch, ActiveSupportInflectorPatch, ActiveSupportStringPatch
Constant Summary collapse
- VERSION =
'0.1.4'
Class Method Summary collapse
-
.active_support ⇒ Object
Hook into ActiveSupport::Inflector to take advantage of FastCamelize.
-
.camelize(*args) ⇒ Object
FastCamelize::camelize.
Class Method Details
.active_support ⇒ Object
Hook into ActiveSupport::Inflector to take advantage of FastCamelize.
65 66 67 68 69 |
# File 'lib/fast_camelize.rb', line 65 def self.active_support ActiveSupport::Inflector.alias_method(:as_camelize, :camelize) ActiveSupport::Inflector.prepend(ActiveSupportInflectorPatch) String.prepend(ActiveSupportStringPatch) end |
.camelize(*args) ⇒ Object
FastCamelize::camelize
169 170 171 172 173 174 175 |
# File 'ext/fast_camelize/fast_camelize.c', line 169
static VALUE fast_camelize(int argc, VALUE* argv, VALUE self) {
VALUE string = Qnil;
VALUE kwargs = Qnil;
rb_scan_args(argc, argv, "10:", &string, &kwargs);
return RB_TYPE_P(string, T_STRING) ? camelize(string, kwargs) : Qnil;
}
|