Module: GitSnip::Options
- Defined in:
- lib/git_snip/options.rb
Class Method Summary collapse
Class Method Details
.merge(primary = {}, secondary = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/git_snip/options.rb', line 7 def self.merge(primary = {}, secondary = {}) primary = primary.dup primary.each_pair do |k, v| if v.is_a?(Array) && v.empty? secondary_value = secondary[k] if secondary_value.is_a?(Array) && secondary_value.any? primary[k] = secondary_value end end end Thor::CoreExt::HashWithIndifferentAccess.new( secondary.merge(primary)).freeze end |