Module: FastUnderscore::ActiveSupportHook
- Included in:
- ActiveSupport::Inflector
- Defined in:
- lib/fast_underscore.rb
Overview
Hooks into ActiveSupport::Inflector and waits for the #underscore method to be defined. When it is, it automatically redefines it by hooking into its acronyms and then still calling the native extension.
Instance Method Summary collapse
Instance Method Details
#method_added(method) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fast_underscore.rb', line 11 def method_added(method) return super if method != :underscore || !defined?(ActiveSupport) require 'active_support/version' if ActiveSupport::VERSION::MAJOR == 5 && ActiveSupport::VERSION::MINOR >= 2 require 'fast_underscore/ext/acronym_underscore_regex' else require 'fast_underscore/ext/acronym_regex' end end |