You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Action Policy provides a useful pretty printing functionality that helps to see why the policy rule returns true or false:
irb> pp :feed?
MyPolicy#feed?
↳ (
admin?#=> false
OR
allowed_to?(:access_feed?) #=> true
)
AND
(
user.name == "Jack"#=> false
OR
user.name == "Kate"#=> true
)
Currently, it relies on Parse and Unparser gems; thus, requiring these libraries to present in the bundle to work. With Prism, we should be able to achieve the same behavior without any third-party dependencies.
Context
Action Policy provides a useful pretty printing functionality that helps to see why the policy rule returns true or false:
Currently, it relies on Parse and Unparser gems; thus, requiring these libraries to present in the bundle to work. With Prism, we should be able to achieve the same behavior without any third-party dependencies.
TODO
Refactor
utils/pretty_print
to use Prism:Prism Ruby API (it uses the same Visitor pattern that we already use with Parser)
Instead of unparsing, we can obtained the original source code string from
node.location
(usingsource[loc.start_offset...loc.end_offset]
).The text was updated successfully, but these errors were encountered: