Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module BuildCanary
- class Leak < Struct.new(:location, :line, :pattern)
- def short_lines(context_length = 30)
- matchdata = pattern.match(line)
- [].tap do |lines|
- 0.upto(matchdata.size-1) do |i|
- start, finish = matchdata.offset(i)
- start -= context_length
- lines << self.line[start, matchdata[i].size + (context_length*2)]
- end
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment