lib/flay.rb in flay-2.0.0.b1 vs lib/flay.rb in flay-2.0.0

- old
+ new

@@ -2,21 +2,22 @@ require 'optparse' require 'rubygems' require 'sexp_processor' require 'ruby_parser' +require 'timeout' class File RUBY19 = "<3".respond_to? :encoding class << self alias :binread :read unless RUBY19 end end class Flay - VERSION = '2.0.0.b1' + VERSION = '2.0.0' def self.default_options { :diff => false, :mass => 16, @@ -168,10 +169,14 @@ self.total += masses[hash] end end def process_rb file - RubyParser.new.process(File.binread(file), file) + begin + RubyParser.new.process(File.binread(file), file) + rescue Timeout::Error + warn "TIMEOUT parsing #{file}. Skipping." + end end def process_sexp pt pt.deep_each do |node| next unless node.any? { |sub| Sexp === sub }