Module: SqlTagger::Initializer
- Defined in:
- lib/sql_tagger.rb
Overview
Mixin that monkey patches the receiver’s initialize method to set @sql_tagger.
Instance Attribute Summary collapse
-
#sql_tagger ⇒ SqlTagger
The SqlTagger used to tag queries for this instance.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#sql_tagger ⇒ SqlTagger
Returns the SqlTagger used to tag queries for this instance.
75 76 77 |
# File 'lib/sql_tagger.rb', line 75 def sql_tagger @sql_tagger end |
Class Method Details
.included(base) ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/sql_tagger.rb', line 63 def self.included(base) base.send(:alias_method, :initialize_without_sql_tagger, :initialize) base.send(:alias_method, :initialize, :initialize_with_sql_tagger) # This is for the odd case where a SQL gem/library is used before # sql_tagger is required. ObjectSpace.each_object(base) do |obj| obj.sql_tagger ||= SqlTagger.default end end |