Class: Browsable::PolicyScanner::Policy

Inherits:
Data
  • Object
show all
Defined in:
lib/browsable/policy_scanner.rb

Overview

One discovered allow_browser callsite.

scope   — the controller/concern it lives in (e.g. "Api::PostsController")
file    — path relative to the project root
result  — a PolicyDetector::Result (the resolved versions, or a note)
only    — action-name strings the policy is limited to, or nil
except  — action-name strings the policy excludes, or nil
concern — true when the callsite is in app/controllers/concerns

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#concernObject (readonly)

Returns the value of attribute concern

Returns:

  • (Object)

    the current value of concern



21
22
23
# File 'lib/browsable/policy_scanner.rb', line 21

def concern
  @concern
end

#exceptObject (readonly)

Returns the value of attribute except

Returns:

  • (Object)

    the current value of except



21
22
23
# File 'lib/browsable/policy_scanner.rb', line 21

def except
  @except
end

#fileObject (readonly)

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



21
22
23
# File 'lib/browsable/policy_scanner.rb', line 21

def file
  @file
end

#onlyObject (readonly)

Returns the value of attribute only

Returns:

  • (Object)

    the current value of only



21
22
23
# File 'lib/browsable/policy_scanner.rb', line 21

def only
  @only
end

#resultObject (readonly)

Returns the value of attribute result

Returns:

  • (Object)

    the current value of result



21
22
23
# File 'lib/browsable/policy_scanner.rb', line 21

def result
  @result
end

#scopeObject (readonly)

Returns the value of attribute scope

Returns:

  • (Object)

    the current value of scope



21
22
23
# File 'lib/browsable/policy_scanner.rb', line 21

def scope
  @scope
end

Instance Method Details

#application_controller?Boolean

Returns:

  • (Boolean)


22
# File 'lib/browsable/policy_scanner.rb', line 22

def application_controller? = scope == "ApplicationController"

#scoped?Boolean

Returns:

  • (Boolean)


23
# File 'lib/browsable/policy_scanner.rb', line 23

def scoped? = !only.nil? || !except.nil?