class Hashema::Hash::Comparison

Private Instance Methods

actual_keys() click to toggle source
# File lib/hashema/schema.rb, line 177
def actual_keys
  @actual_keys ||= Set.new(actual.keys)
end
demanded_keys() click to toggle source
# File lib/hashema/schema.rb, line 171
def demanded_keys
  @demanded_keys ||= Set.new(expected_keys.select { |key|
    fetch(key, expected).required_if_map_value?
  })
end
expected_class() click to toggle source
# File lib/hashema/schema.rb, line 147
def expected_class
  ::Hash
end
expected_keys() click to toggle source
# File lib/hashema/schema.rb, line 167
def expected_keys
  @expected_keys ||= Set.new(expected.keys)
end
extra_keys() click to toggle source
# File lib/hashema/schema.rb, line 151
def extra_keys
  @extra_keys ||= actual_keys - expected_keys
end
fetch(key, hash) click to toggle source
# File lib/hashema/schema.rb, line 163
def fetch(key, hash)
  hash[key]
end
matching_keys() click to toggle source
# File lib/hashema/schema.rb, line 159
def matching_keys
  @matching_keys ||= expected.keys & actual.keys
end
missing_keys() click to toggle source
# File lib/hashema/schema.rb, line 155
def missing_keys
  @missing_keys ||= demanded_keys - actual_keys
end