Class: Replicat::ScopeProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/replicat/scope_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ ScopeProxy

Returns a new instance of ScopeProxy.



3
4
5
6
# File 'lib/replicat/scope_proxy.rb', line 3

def initialize(attributes)
  @klass = attributes[:klass]
  @connection_name = attributes[:connection_name]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object (private)



10
11
12
13
14
15
16
17
18
# File 'lib/replicat/scope_proxy.rb', line 10

def method_missing(method_name, *args, &block)
  result = using { @klass.send(method_name, *args, &block) }
  if result.respond_to?(:scoped)
    @klass = result
    self
  else
    result
  end
end