Class: RemoteResource::ScopeEvaluator
- Inherits:
-
Object
- Object
- RemoteResource::ScopeEvaluator
- Defined in:
- lib/remote_resource/scope_evaluator.rb
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
- #evaluate_on(target_object) ⇒ Object
-
#initialize(scope = nil) ⇒ ScopeEvaluator
constructor
A new instance of ScopeEvaluator.
Constructor Details
#initialize(scope = nil) ⇒ ScopeEvaluator
Returns a new instance of ScopeEvaluator.
5 6 7 |
# File 'lib/remote_resource/scope_evaluator.rb', line 5 def initialize(scope = nil) @scope = normalize_scope(scope) end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
3 4 5 |
# File 'lib/remote_resource/scope_evaluator.rb', line 3 def scope @scope end |
Instance Method Details
#evaluate_on(target_object) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/remote_resource/scope_evaluator.rb', line 9 def evaluate_on(target_object) scope = {} @scope.each_pair do |attr_key, target_method| scope[attr_key.to_sym] = target_object.send(target_method.to_sym) end scope end |