Class: ActionPolicy::Testing::AuthorizeTracker::Scoping
- Inherits:
-
Object
- Object
- ActionPolicy::Testing::AuthorizeTracker::Scoping
- Includes:
- Context
- Defined in:
- lib/action_policy/testing.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#policy ⇒ Object
readonly
Returns the value of attribute policy.
-
#scope_options ⇒ Object
readonly
Returns the value of attribute scope_options.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(policy, target, type, name, scope_options) ⇒ Scoping
constructor
A new instance of Scoping.
- #inspect ⇒ Object
- #matches?(policy_class, actual_type, actual_name, actual_scope_options, actual_context) ⇒ Boolean
Constructor Details
#initialize(policy, target, type, name, scope_options) ⇒ Scoping
Returns a new instance of Scoping.
45 46 47 48 49 50 51 |
# File 'lib/action_policy/testing.rb', line 45 def initialize(policy, target, type, name, ) @policy = policy @target = target @type = type @name = name @scope_options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
43 44 45 |
# File 'lib/action_policy/testing.rb', line 43 def name @name end |
#policy ⇒ Object (readonly)
Returns the value of attribute policy.
43 44 45 |
# File 'lib/action_policy/testing.rb', line 43 def policy @policy end |
#scope_options ⇒ Object (readonly)
Returns the value of attribute scope_options.
43 44 45 |
# File 'lib/action_policy/testing.rb', line 43 def @scope_options end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
43 44 45 |
# File 'lib/action_policy/testing.rb', line 43 def target @target end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
43 44 45 |
# File 'lib/action_policy/testing.rb', line 43 def type @type end |
Instance Method Details
#inspect ⇒ Object
61 62 63 |
# File 'lib/action_policy/testing.rb', line 61 def inspect "#{policy.class} :#{name} for :#{type} #{}" end |
#matches?(policy_class, actual_type, actual_name, actual_scope_options, actual_context) ⇒ Boolean
53 54 55 56 57 58 59 |
# File 'lib/action_policy/testing.rb', line 53 def matches?(policy_class, actual_type, actual_name, , actual_context) policy_class == policy.class && type == actual_type && name == actual_name && === && context_matches?(actual_context, policy.) end |