Class: ActionPolicy::Testing::AuthorizeTracker::Scoping

Inherits:
Object
  • Object
show all
Defined in:
lib/action_policy/testing.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(policy, target, type, name, scope_options) ⇒ Scoping

Returns a new instance of Scoping.



39
40
41
42
43
44
45
# File 'lib/action_policy/testing.rb', line 39

def initialize(policy, target, type, name, scope_options)
  @policy = policy
  @target = target
  @type = type
  @name = name
  @scope_options = scope_options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



37
38
39
# File 'lib/action_policy/testing.rb', line 37

def name
  @name
end

#policyObject (readonly)

Returns the value of attribute policy.



37
38
39
# File 'lib/action_policy/testing.rb', line 37

def policy
  @policy
end

#scope_optionsObject (readonly)

Returns the value of attribute scope_options.



37
38
39
# File 'lib/action_policy/testing.rb', line 37

def scope_options
  @scope_options
end

#targetObject (readonly)

Returns the value of attribute target.



37
38
39
# File 'lib/action_policy/testing.rb', line 37

def target
  @target
end

#typeObject (readonly)

Returns the value of attribute type.



37
38
39
# File 'lib/action_policy/testing.rb', line 37

def type
  @type
end

Instance Method Details

#inspectObject



54
55
56
# File 'lib/action_policy/testing.rb', line 54

def inspect
  "#{policy.class} :#{name} for :#{type} #{scope_options_message}"
end

#matches?(policy_class, actual_type, actual_name, actual_scope_options) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
50
51
52
# File 'lib/action_policy/testing.rb', line 47

def matches?(policy_class, actual_type, actual_name, actual_scope_options)
  policy_class == policy.class &&
    type == actual_type &&
    name == actual_name &&
    actual_scope_options === scope_options
end