Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/fireeagle.rb

Overview

FireEagle additions to the Hash class

Instance Method Summary collapse

Instance Method Details

#has_all_or_none_keys?(*my_keys) ⇒ Boolean

Returns true if the ALL or NONE of the given keys are present in my_keys.

Returns:

  • (Boolean)


46
47
48
49
50
51
52
53
# File 'lib/fireeagle.rb', line 46

def has_all_or_none_keys?(*my_keys)
  size = my_keys.length
  false_count = 0
  my_keys.each do |k|
    false_count += 1 unless keys.include?(k)
  end
  false_count == 0 or false_count == size
end