lib/faster_require.rb in faster_require-0.9.3 vs lib/faster_require.rb in faster_require-0.9.4
- old
+ new
@@ -255,15 +255,15 @@
$LOADED_FEATURES << relative_full_path unless $LOADED_FEATURES.index(relative_full_path) # add in with .rb, too, for autoload
# load(known_loc, false) # too slow
# use eval: if this fails to load breaks re-save the offending file in binary mode, or file an issue on the faster_require tracker...
- contents = File.open(known_loc, 'rb') {|f| f.read} # read only costs 0.34/10.0 s...
+ contents = File.open(known_loc, 'rb:utf-8') {|f| f.read} # read only costs 0.34/10.0 s...
if contents =~ /require_relative/ # =~ is faster apparently faster than .include?
load(known_loc, false) # load is slow, but overcomes a ruby core bug: http://redmine.ruby-lang.org/issues/4487
else
- Kernel.eval(contents, TOPLEVEL_BINDING, known_loc) # note the 'rb' here--this means it's reading .rb files as binary, which *typically* works...maybe unnecessary though?
+ eval(contents, TOPLEVEL_BINDING, known_loc)
end
ensure
raise 'unexpected' unless IN_PROCESS.pop == known_loc
end
return true
@@ -361,6 +361,6 @@
alias :original_non_cached_require :require
alias :require :require_cached
end
end
-end
\ No newline at end of file
+end