Class: WillPaginate::NamedScope::Scope
- Inherits:
-
Object
- Object
- WillPaginate::NamedScope::Scope
- Defined in:
- lib/will_paginate/named_scope.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#proxy_options ⇒ Object
readonly
Returns the value of attribute proxy_options.
-
#proxy_scope ⇒ Object
readonly
Returns the value of attribute proxy_scope.
Instance Method Summary collapse
-
#initialize(proxy_scope, options, &block) ⇒ Scope
constructor
A new instance of Scope.
- #reload ⇒ Object
Constructor Details
#initialize(proxy_scope, options, &block) ⇒ Scope
Returns a new instance of Scope.
101 102 103 104 105 |
# File 'lib/will_paginate/named_scope.rb', line 101 def initialize(proxy_scope, , &block) [[:extend]].flatten.each { |extension| extend extension } if [:extend] extend Module.new(&block) if block_given? @proxy_scope, @proxy_options = proxy_scope, .except(:extend) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
117 118 119 120 121 122 123 124 125 |
# File 'lib/will_paginate/named_scope.rb', line 117 def method_missing(method, *args, &block) if scopes.include?(method) scopes[method].call(self, *args) else with_scope :find => do proxy_scope.send(method, *args, &block) end end end |
Instance Attribute Details
#proxy_options ⇒ Object (readonly)
Returns the value of attribute proxy_options.
97 98 99 |
# File 'lib/will_paginate/named_scope.rb', line 97 def @proxy_options end |
#proxy_scope ⇒ Object (readonly)
Returns the value of attribute proxy_scope.
97 98 99 |
# File 'lib/will_paginate/named_scope.rb', line 97 def proxy_scope @proxy_scope end |
Instance Method Details
#reload ⇒ Object
107 108 109 |
# File 'lib/will_paginate/named_scope.rb', line 107 def reload load_found; self end |