Class: NiftyScope::Scope
- Inherits:
-
Object
- Object
- NiftyScope::Scope
- Defined in:
- lib/nifty_scope/scope.rb
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(scope, params, options) ⇒ Scope
constructor
A new instance of Scope.
Constructor Details
#initialize(scope, params, options) ⇒ Scope
Returns a new instance of Scope.
5 6 7 8 9 |
# File 'lib/nifty_scope/scope.rb', line 5 def initialize(scope, params, ) @scope = scope @mapping = [:mapping] || {} @params = filter(params, ) end |
Instance Method Details
#apply ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/nifty_scope/scope.rb', line 11 def apply @params.each do |key, value| scope_method = scope_method_for(key.to_sym) ensure_scope_responds_to(scope_method) @scope = eval_scope(scope_method, value) end @scope end |