lib/procemon/function/proc_source/proc.rb in procemon-0.6.1 vs lib/procemon/function/proc_source/proc.rb in procemon-0.6.2
- old
+ new
@@ -12,10 +12,14 @@
unless ProcSource.source_cache[self.inspect].nil?
return ProcSource.source_cache[self.inspect]
else
+ if self.source_location.nil?
+ return "Proc.new { }"
+ 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
return_string.concat(line)
break if block == 0
@@ -26,10 +30,12 @@
if !return_string.include?('Proc.new')
return_string.sub!(/^[^{]*(?!={)/,'Proc.new')
end
- ProcSource.source_cache[self.inspect]= return_string
+ if !self.source_location.nil?
+ ProcSource.source_cache[self.inspect]= return_string
+ end
return return_string
end
end
alias :source_string :source
\ No newline at end of file