summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2017-12-20 09:22:15 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2017-12-20 09:22:15 -0800
commit3628243bc0af1eb19f1844c7e22da6aa6d46e074 (patch)
tree5777c44e8b32e93c0c97875c9b2d5933a3d9106e /README.md
parent39b1e826d2e505fb35022fd9bf4f3a6dc0ee5702 (diff)
downloadpsych-3628243bc0af1eb19f1844c7e22da6aa6d46e074.zip
Add a predicate method to each node
This allows the AST to be searched via a predicate method rather than hardcoding the class name and doing is_a? checks. For example, rather than: ``` ast.grep(Psych::Nodes::Scalar).each do |node| # .. do something end ``` Now you can do: ``` ast.find_all(&:scalar?).each do |node| # .. do something end ``` Your code no longer needs to know the exact class used in the AST.
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions