Method: ActionPolicy::Policy::Core#pp
- Defined in:
- lib/action_policy/policy/core.rb
#pp(rule) ⇒ Object
Helper for printing the annotated rule source. Useful for debugging: type ‘pp :show?` within the context of the policy to preview the rule.
157 158 159 160 161 162 163 164 165 |
# File 'lib/action_policy/policy/core.rb', line 157 def pp(rule) with_clean_result do # We need result to exist for `allowed_to?` to work correctly @result = self.class.result_class.new(self.class, rule) header = "#{self.class.name}##{rule}" source = inspect_rule(rule) $stdout.puts "#{header}\n#{source}" end end |