class VerifyKeyInHash
Used to validate incoming parameter hash.
Attributes
hash[R]
key[R]
Public Class Methods
call(hash, key)
click to toggle source
# File lib/prolog_minitest_matchers/matchers/asserters/verify_key_in_hash.rb, line 5 def self.call(hash, key) VerifyKeyInHash.new(hash, key).call end
new(hash, key)
click to toggle source
# File lib/prolog_minitest_matchers/matchers/asserters/verify_key_in_hash.rb, line 15 def initialize(hash, key) @hash = hash @key = key self end
Public Instance Methods
call()
click to toggle source
# File lib/prolog_minitest_matchers/matchers/asserters/verify_key_in_hash.rb, line 9 def call raise KeyError, no_key_message unless key_in_hash? end
Private Instance Methods
key_in_hash?()
click to toggle source
# File lib/prolog_minitest_matchers/matchers/asserters/verify_key_in_hash.rb, line 25 def key_in_hash? hash.key? key end
no_key_message()
click to toggle source
# File lib/prolog_minitest_matchers/matchers/asserters/verify_key_in_hash.rb, line 29 def no_key_message "No key :#{key} in #{hash}!" end