Class: Scrooge::Callsite
- Inherits:
-
Object
- Object
- Scrooge::Callsite
- Defined in:
- lib/callsite.rb
Constant Summary collapse
- Mtx =
Represents a Callsite and is a container for any columns and associations referenced at the callsite.
Mutex.new
Instance Attribute Summary collapse
-
#associations ⇒ Object
Lazy init associations.
-
#columns ⇒ Object
Lazy init columns.
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#signature ⇒ Object
Returns the value of attribute signature.
Instance Method Summary collapse
-
#association!(association) ⇒ Object
Flag an association as seen.
-
#column!(column) ⇒ Object
Flag a column as seen.
-
#default_columns ⇒ Object
Lazy init default columns.
-
#initialize(klass, signature) ⇒ Callsite
constructor
A new instance of Callsite.
- #inspect ⇒ Object
Constructor Details
#initialize(klass, signature) ⇒ Callsite
Returns a new instance of Callsite.
15 16 17 18 |
# File 'lib/callsite.rb', line 15 def initialize( klass, signature ) @klass = klass @signature = signature end |
Instance Attribute Details
#associations ⇒ Object
Lazy init associations
54 55 56 |
# File 'lib/callsite.rb', line 54 def associations @associations end |
#columns ⇒ Object
Lazy init columns
48 49 50 |
# File 'lib/callsite.rb', line 48 def columns @columns end |
#klass ⇒ Object
Returns the value of attribute klass.
10 11 12 |
# File 'lib/callsite.rb', line 10 def klass @klass end |
#signature ⇒ Object
Returns the value of attribute signature.
10 11 12 |
# File 'lib/callsite.rb', line 10 def signature @signature end |
Instance Method Details
#association!(association) ⇒ Object
Flag an association as seen
30 31 32 33 34 |
# File 'lib/callsite.rb', line 30 def association!( association ) Mtx.synchronize do associations << association if preloadable_association?( association ) end end |
#column!(column) ⇒ Object
Flag a column as seen
22 23 24 25 26 |
# File 'lib/callsite.rb', line 22 def column!( column ) Mtx.synchronize do columns << column end end |
#default_columns ⇒ Object
Lazy init default columns
42 43 44 |
# File 'lib/callsite.rb', line 42 def default_columns @default_columns ||= setup_columns end |
#inspect ⇒ Object
36 37 38 |
# File 'lib/callsite.rb', line 36 def inspect "<##{@klass.name} :select => '#{@klass.scrooge_select_sql( columns )}', :include => [#{associations_for_inspect}]>" end |