From 8ded5b690f1c31e79c4cb51e7bd90fcca35b535f Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 8 Oct 2016 19:20:54 +0200 Subject: [PATCH] No need to check if `Encoding` is defined. --- Library/Homebrew/cask/lib/hbc/cask_loader.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/cask_loader.rb b/Library/Homebrew/cask/lib/hbc/cask_loader.rb index f91ad241f1..3875b30df2 100644 --- a/Library/Homebrew/cask/lib/hbc/cask_loader.rb +++ b/Library/Homebrew/cask/lib/hbc/cask_loader.rb @@ -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