Class: ActionPolicy::Testing::AuthorizeTracker::Call
- Inherits:
-
Object
- Object
- ActionPolicy::Testing::AuthorizeTracker::Call
- Defined in:
- lib/action_policy/testing.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#policy ⇒ Object
readonly
Returns the value of attribute policy.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Instance Method Summary collapse
-
#initialize(policy, rule) ⇒ Call
constructor
A new instance of Call.
- #inspect ⇒ Object
- #matches?(policy_class, actual_rule, target, context) ⇒ Boolean
Constructor Details
#initialize(policy, rule) ⇒ Call
Returns a new instance of Call.
11 12 13 14 |
# File 'lib/action_policy/testing.rb', line 11 def initialize(policy, rule) @policy = policy @rule = rule end |
Instance Attribute Details
#policy ⇒ Object (readonly)
Returns the value of attribute policy.
9 10 11 |
# File 'lib/action_policy/testing.rb', line 9 def policy @policy end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
9 10 11 |
# File 'lib/action_policy/testing.rb', line 9 def rule @rule end |
Instance Method Details
#inspect ⇒ Object
22 23 24 25 |
# File 'lib/action_policy/testing.rb', line 22 def inspect "#{policy.record.inspect} was authorized with #{policy.class}##{rule} " \ "and context #{policy..inspect}" end |
#matches?(policy_class, actual_rule, target, context) ⇒ Boolean
16 17 18 19 20 |
# File 'lib/action_policy/testing.rb', line 16 def matches?(policy_class, actual_rule, target, context) policy_class == policy.class && (target.is_a?(Class) ? target == policy.record : target === policy.record) && rule == actual_rule && context_matches?(context, policy.) end |