Class: Kitchen::Driver::Dokken::PartialHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/kitchen/driver/dokken.rb

Overview

A Hash that compares equal to any Hash containing all of its pairs.

The daemon echoes back more volumes than we asked for, so a plain equality check against the requested set would never match.

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Boolean

Whether other contains every pair this hash holds.

Parameters:

  • other (Object)

    the value to compare against

Returns:

  • (Boolean)

    true when other is a superset hash



235
236
237
# File 'lib/kitchen/driver/dokken.rb', line 235

def ==(other)
  other.is_a?(Hash) && all? { |key, val| other.key?(key) && other[key] == val }
end