module Ellipses::Support::Refinements::Struct::FromHashWithoutBogusKeys
Public Instance Methods
from_hash_without_bogus_keys!(hash, error:)
click to toggle source
# File lib/ellipses/support/refinements.rb, line 9 def from_hash_without_bogus_keys!(hash, error:) bogus = (hash = hash.transform_keys(&:to_sym)).keys.reject { |key| members.include?(key) } raise error, "Bogus keys found: #{bogus}" unless bogus.empty? new hash.slice(*members) end