What is the best approach to ignore some lines when reading / analyzing a file (using Ruby)?
I am trying to parse only the scripts from the Cucumber.feature file and would like to skip lines that do not start with the words Scenario / Given / When / Then / And / But.
The code below works, but it's funny, so I'm looking for a smart solution :)
File.open(file).each_line do |line|
line.chomp!
next if line.empty?
next if line.include? "#"
next if line.include? "Feature"
next if line.include? "In order"
next if line.include? "As a"
next if line.include? "I want"
source
share