Skip to content

Commit

Permalink
Style changes in language_eval.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Oct 3, 2016
1 parent ef26bf1 commit e2b3753
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Library/Homebrew/cask/lib/hbc/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,25 @@ def language(*args, default: false, &block)
@language_blocks.default = block
else
language_eval
@language
end
end

def language_eval
return if instance_variable_defined?(:@language)
return @language if instance_variable_defined?(:@language)

return unless instance_variable_defined?(:@language_blocks)
if @language_blocks.nil? || @language_blocks.empty?
return @language = nil
end

MacOS.languages.map(&Locale.method(:parse)).any? { |locale|
MacOS.languages.map(&Locale.method(:parse)).each do |locale|
key = @language_blocks.keys.detect { |strings|
strings.any? { |string| locale.include?(string) }
}

return @language = @language_blocks[key].call unless key.nil?
}
next if key.nil?

return @language = @language_blocks[key].call
end

@language = @language_blocks.default.call
end
Expand Down

0 comments on commit e2b3753

Please sign in to comment.