Module: Toqua::Scoping
- Extended by:
- ActiveSupport::Concern
- Included in:
- KeysetPagination, Pagination, Search
- Defined in:
- lib/toqua/scoping.rb
Defined Under Namespace
Classes: ScopeApplicable
Instance Method Summary collapse
Instance Method Details
#__run_scope(relation, scope, opts) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/toqua/scoping.rb', line 47 def __run_scope(relation, scope, opts) if ScopeApplicable.accept?(opts, self) instance_exec(relation, &scope) else relation end end |
#apply_scopes(start) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/toqua/scoping.rb', line 7 def apply_scopes(start) s = start self.class.__scopes.each do |scope, opts| s = __run_scope(s, scope, opts) end s end |