Skip to content

Commit

Permalink
move Hash monkeypatch to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandwalker committed Dec 27, 2014
1 parent dfe6307 commit 1163e1d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions lib/cask/extend.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# monkeypatching
require 'cask/extend/hash'
require 'cask/extend/string'
require 'cask/extend/pathname'
8 changes: 8 additions & 0 deletions lib/cask/extend/hash.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Hash
def assert_valid_keys(*valid_keys)
unknown_keys = self.keys - valid_keys
unless unknown_keys.empty?
raise CaskError.new %Q{Unknown keys: #{unknown_keys.inspect}. Running "#{UPDATE_CMD}" will likely fix it.}
end
end
end
10 changes: 0 additions & 10 deletions lib/cask/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ def utf8_inspect
end
end

# monkeypatch Hash
class Hash
def assert_valid_keys(*valid_keys)
unknown_keys = self.keys - valid_keys
unless unknown_keys.empty?
raise CaskError.new %Q{Unknown keys: #{unknown_keys.inspect}. Running "brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup" will likely fix it.}
end
end
end

class Buffer < StringIO
def initialize(tty = false)
super()
Expand Down

0 comments on commit 1163e1d

Please sign in to comment.