0

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

kimsanity
  • 17
  • 3

1 Answers1

0

lex accepts a IO object, so you can call it like Ripper.lex(File.open('path_to_file')).

adamliesko
  • 1,887
  • 1
  • 14
  • 21