Module: SqlTagger::ModuleMethods
Overview
Extend this module in your adapter module
Instance Method Summary collapse
-
#included(base) ⇒ Object
Callback that includes SqlTagger::Initializer and does method aliasing.
Instance Method Details
#included(base) ⇒ Object
Callback that includes SqlTagger::Initializer and does method aliasing.
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/sql_tagger.rb', line 97 def included(base) base.send(:include, SqlTagger::Initializer) self.instance_methods.map(&:to_s).grep(/_with_sql_tagger$/).each do |with_method| target = with_method.sub(/_with_sql_tagger$/, '') if base.method_defined?(target) base.send(:alias_method, "#{target}_without_sql_tagger", target) base.send(:alias_method, target, with_method) end end end |