Class: Sinatra::Jwt::TopLevelKeyArrayDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra/jwt/top_level_key_array_diff.rb

Class Method Summary collapse

Class Method Details

.added_attr_or_appended?(request_hash, required_hash) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sinatra/jwt/top_level_key_array_diff.rb', line 6

def self.added_attr_or_appended?(request_hash, required_hash)
  return false if request_hash == required_hash

  required_hash.each do |key, value|
    next if request_hash[key] == value
    return true if request_hash[key].nil?

    return true unless (value - request_hash[key]).empty?
  end
  false
rescue StandardError
  true
end