Skip to content

Instantly share code, notes, and snippets.

@pirj pirj/match.rb
Last active May 22, 2019

What would you like to do?
NodePattern debug boilerplate
def match(pattern, source)
ruby_version = RUBY_VERSION.to_f
node_pattern =
ast =, ruby_version).ast
match('(send nil? :sum $...)', 'sum(1,2,3,n)')
# => [s(:int, 1), s(:int, 2), s(:int, 3), s(:send, nil, :n)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.