Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def match(pattern, source)
- ruby_version = RUBY_VERSION.to_f
- node_pattern = NodePattern.new(pattern)
- ast = RuboCop::ProcessedSource.new(source, ruby_version).ast
- node_pattern.match(ast)
- end
- match('(send nil? :sum $...)', 'sum(1,2,3,n)')
- # => [s(:int, 1), s(:int, 2), s(:int, 3), s(:send, nil, :n)]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement