Sha256: 5722f9cf8e7116e05d4c23cc94da93f628c85e12c1f8ebece3dcbf4dd7d536be

Contents?: true

Size: 707 Bytes

Versions: 74

Compression:

Stored size: 707 Bytes

Contents

module LintRoller
  module Support
    class MergesUpstreamMetadata
      def merge(plugin_yaml, upstream_yaml)
        common_upstream_values = upstream_yaml.select { |key| plugin_yaml.key?(key) }

        plugin_yaml.merge(common_upstream_values) { |key, plugin_value, upstream_value|
          if plugin_value.is_a?(Hash) && upstream_value.is_a?(Hash)
            plugin_value.merge(upstream_value) { |sub_key, plugin_sub_value, upstream_sub_value|
              if plugin_value.key?(sub_key)
                plugin_sub_value
              else
                upstream_sub_value
              end
            }
          else
            plugin_value
          end
        }
      end
    end
  end
end

Version data entries

74 entries across 74 versions & 3 rubygems

Version Path
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.2.10 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.2.9 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.2.8 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.2.7 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.2.6 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.2.5 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.2.4 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.2.3 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.2.2 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.2.1 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.2.0 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.1.99 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.1.98 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.1.97 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.1.96 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.1.95 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.1.94 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.1.93 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb
harbr-0.1.91 vendor/bundle/ruby/3.2.0/gems/lint_roller-1.1.0/lib/lint_roller/support/merges_upstream_metadata.rb