Module: FastParameterize
- Defined in:
- lib/fast_parameterize.rb,
lib/fast_parameterize/version.rb,
ext/fast_parameterize/fast_parameterize.c
Overview
By default, FastParameterize already defines String#parameterize and FastParameterize::parameterize. In the case that we’re using ActiveSupport, however, there is the additional functionality of transliteration 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 parameterization.
Defined Under Namespace
Modules: ActiveSupportDelayedPatch, ActiveSupportInflectorPatch, ActiveSupportStringPatch
Constant Summary collapse
- VERSION =
'0.1.2'
Class Method Summary collapse
-
.active_support ⇒ Object
Hook into ActiveSupport::Inflector and String to take advantage of FastParameterize.
-
.parameterize(*args) ⇒ Object
FastParameterize::parameterize.
Class Method Details
.active_support ⇒ Object
Hook into ActiveSupport::Inflector and String to take advantage of FastParameterize.
46 47 48 49 50 |
# File 'lib/fast_parameterize.rb', line 46 def self.active_support ActiveSupport::Inflector.alias_method(:as_parameterize, :parameterize) ActiveSupport::Inflector.prepend(ActiveSupportInflectorPatch) String.prepend(ActiveSupportStringPatch) end |
.parameterize(*args) ⇒ Object
FastParameterize::parameterize
117 118 119 120 121 122 123 |
# File 'ext/fast_parameterize/fast_parameterize.c', line 117
static VALUE fast_parameterize(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) ? parameterize(string, kwargs) : Qnil;
}
|