lib/procemon/function/proc_source/method.rb in procemon-0.6.2 vs lib/procemon/function/proc_source/method.rb in procemon-0.6.3

- old
+ new

@@ -13,11 +13,11 @@ unless ProcSource.source_cache[self.inspect].nil? return ProcSource.source_cache[self.inspect] else if self.source_location.nil? - return "Proc.new { }" + return nil end File.open(File.expand_path(self.source_location[0]) ).each_line_from self.source_location[1] do |line| block += line.source_formater_for_line_sub @@ -36,10 +36,11 @@ if args_to_replace != String.new return_string.sub!(args_to_replace,"|#{args_to_replace}|") end - rescue TypeError,NilError + rescue TypeError,NoMethodError + return nil end return_string.sub!(/\s*\bdef\s*[\w\S]*/,'Proc.new{') return_string.sub!(/}[^}]*$/,"}") \ No newline at end of file