Class: Glib::ApplicationPolicy
- Inherits:
-
Object
- Object
- Glib::ApplicationPolicy
- Defined in:
- app/policies/glib/application_policy.rb
Defined Under Namespace
Classes: Scope
Class Attribute Summary collapse
-
.catch_all ⇒ Object
readonly
Returns the value of attribute catch_all.
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#policy_name ⇒ Object
readonly
Returns the value of attribute policy_name.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
- #scope ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
102 103 104 105 106 107 108 |
# File 'app/policies/glib/application_policy.rb', line 102 def method_missing(name, *args, &block) if respond_to_missing?(name) && catch_all call_catch_all else super end end |
Class Attribute Details
.catch_all ⇒ Object (readonly)
Returns the value of attribute catch_all.
23 24 25 |
# File 'app/policies/glib/application_policy.rb', line 23 def catch_all @catch_all end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
5 6 7 |
# File 'app/policies/glib/application_policy.rb', line 5 def context @context end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
6 7 8 |
# File 'app/policies/glib/application_policy.rb', line 6 def controller @controller end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'app/policies/glib/application_policy.rb', line 6 def params @params end |
#policy_name ⇒ Object (readonly)
Returns the value of attribute policy_name.
6 7 8 |
# File 'app/policies/glib/application_policy.rb', line 6 def policy_name @policy_name end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
6 7 8 |
# File 'app/policies/glib/application_policy.rb', line 6 def record @record end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
6 7 8 |
# File 'app/policies/glib/application_policy.rb', line 6 def request @request end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'app/policies/glib/application_policy.rb', line 6 def user @user end |
Class Method Details
.args_builder ⇒ Object
121 122 123 |
# File 'app/policies/glib/application_policy.rb', line 121 def self.args_builder proc { |_controller| [] } end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
110 111 112 |
# File 'app/policies/glib/application_policy.rb', line 110 def respond_to_missing?(method_name, include_private = false) method_name.to_s.end_with?('?') || super end |
#scope ⇒ Object
114 115 116 117 118 119 |
# File 'app/policies/glib/application_policy.rb', line 114 def scope policy_scope_class = Pundit::PolicyFinder.new(@policy_name).scope return unless policy_scope_class controller.policy_scope(record.class, policy_scope_class: policy_scope_class) end |