From 3b4ee58c491f164c2751c1c0f941568c35fb0ac6 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 26 Jun 2017 07:30:28 +0200 Subject: Refactor using `Forwardable` and `DelegateClass`. --- Library/Homebrew/cask/lib/hbc/utils.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/cask/lib/hbc/utils.rb') diff --git a/Library/Homebrew/cask/lib/hbc/utils.rb b/Library/Homebrew/cask/lib/hbc/utils.rb index 59e85aaeb..f23ce059c 100644 --- a/Library/Homebrew/cask/lib/hbc/utils.rb +++ b/Library/Homebrew/cask/lib/hbc/utils.rb @@ -14,14 +14,14 @@ class Object end class Buffer < StringIO + extend Predicable + + attr_predicate :tty? + def initialize(tty = false) super() @tty = tty end - - def tty? - @tty - end end # global methods -- cgit v1.2.3 From 2703646b1008e8fc0a922e4677d9b2aadcea4b4d Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 27 Jun 2017 11:55:23 +0200 Subject: Remove `utf8_inspect` method. --- Library/Homebrew/cask/lib/hbc/utils.rb | 9 --------- 1 file changed, 9 deletions(-) (limited to 'Library/Homebrew/cask/lib/hbc/utils.rb') diff --git a/Library/Homebrew/cask/lib/hbc/utils.rb b/Library/Homebrew/cask/lib/hbc/utils.rb index f23ce059c..22f826e74 100644 --- a/Library/Homebrew/cask/lib/hbc/utils.rb +++ b/Library/Homebrew/cask/lib/hbc/utils.rb @@ -4,15 +4,6 @@ require "stringio" BUG_REPORTS_URL = "https://github.com/caskroom/homebrew-cask#reporting-bugs".freeze -# monkeypatch Object - not a great idea -class Object - def utf8_inspect - return inspect unless defined?(Encoding) - return map(&:utf8_inspect) if respond_to?(:map) - inspect.force_encoding("UTF-8").sub(/\A"(.*)"\Z/, '\1') - end -end - class Buffer < StringIO extend Predicable -- cgit v1.2.3