Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
16 lines (15 sloc) 407 Bytes
def select(file, re1, re2)
lines = File.readlines(file).map {|line| line.rstrip}
filtered_lines = []
state = :before_first
lines.each do |line|
if state == :before_first and re1 =~ line
filtered_lines << line
state = :after_first
elsif state == :after_first
filtered_lines << line
break if line =~ re2
end
end
filtered_lines
end