Class: Replidog::ScopeProxy
- Inherits:
-
Object
- Object
- Replidog::ScopeProxy
- Defined in:
- lib/replidog/scope_proxy.rb
Instance Method Summary collapse
-
#initialize(attributes) ⇒ ScopeProxy
constructor
A new instance of ScopeProxy.
Constructor Details
#initialize(attributes) ⇒ ScopeProxy
Returns a new instance of ScopeProxy.
3 4 5 6 |
# File 'lib/replidog/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/replidog/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 |