I want to check the source of a file (maybe a view) if it contains logic, so I thought of using Ripper.lex but I'm not sure if it's possible to pass a file to .lex and it will read the code IN the file.
Like if I have source.rb or source.haml.erb, and pass it to Ripper? like Ripper.lex(filename='source.haml.erb')
Is it possible? I've tried searching about it but can't see this kind of use with Ripper
lex
accepts a IO object, so you can call it like Ripper.lex(File.open('path_to_file'))
.