No need to check if Encoding is defined.

This commit is contained in:
Markus Reiter 2016-10-08 19:20:54 +02:00
parent 67a7d1a64a
commit 8ded5b690f

View File

@ -6,14 +6,7 @@ module Hbc
raise CaskError, "File '#{path}' is not a plain file" unless path.file?
token = path.basename(".rb").to_s
content = File.open(path, "rb") do |caskfile|
if defined?(Encoding)
caskfile.read.force_encoding("UTF-8")
else
caskfile.read
end
end
content = IO.read(path).force_encoding("UTF-8")
new(token, content, path).load
end