diff options
| author | Martin Schimandl | 2017-10-14 17:39:26 +0200 |
|---|---|---|
| committer | Martin Schimandl | 2017-11-10 20:16:38 +0100 |
| commit | 52343142a7d9cb871fc1f4affc3edb9caff69ab5 (patch) | |
| tree | 166091184e3ff259a18f3b238539d5c4b4d0110e /Library | |
| parent | d03720320ad22c564cb2675d919d09677f368a9b (diff) | |
| download | brew-52343142a7d9cb871fc1f4affc3edb9caff69ab5.tar.bz2 | |
Remove unused variables. Refactor code
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb index dd7bf6e9c..5929d0503 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb @@ -24,9 +24,6 @@ module Hbc ARTIFACTS = DSL::ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key) + DSL::ARTIFACT_BLOCK_CLASSES.map(&:dsl_key) - ARTIFACTS_CLASSES = - DSL::ORDINARY_ARTIFACT_CLASSES + - DSL::ARTIFACT_BLOCK_CLASSES option "--table", :table, false option "--quiet", :quiet, false @@ -69,27 +66,12 @@ module Hbc end if stanza == :artifacts - result = {} - value.each do |e| - result[e.class.dsl_key] = e.summarize - end - value = result - end - - if artifact_name - result = nil - value.each do |k, v| - if k == artifact_name - result = v - break - end - end - value = result + value = Hash[value.map { |v| [v.class.dsl_key, v] }] + value = value[artifact_name] if artifact_name end if value.nil? || (value.respond_to?(:to_a) && value.to_a.empty?) || - (value.respond_to?(:to_s) && value.to_s == "{}") # || - + (value.respond_to?(:to_s) && value.to_s == "{}") raise CaskError, "no such stanza '#{artifact_name ? artifact_name : stanza}' on Cask '#{cask}'" end |
