From 2a0cd36b5e67a8e65f2a61f0c6f30758cca7976a Mon Sep 17 00:00:00 2001 From: Jeremy Woertink Date: Fri, 23 Oct 2020 11:01:38 -0700 Subject: [PATCH] Adding new has_key_for? method to params (#500) * Adding new has_key_for? method to params. Fixes #72 * Consolidate this method since its implementation is always the same. --- src/avram/paramable.cr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/avram/paramable.cr b/src/avram/paramable.cr index 8adb08d0f..ed7e01a5f 100644 --- a/src/avram/paramable.cr +++ b/src/avram/paramable.cr @@ -3,4 +3,8 @@ module Avram::Paramable abstract def nested(key : String) : Hash(String, String) abstract def get?(key : String) abstract def get(key : String) + + def has_key_for?(operation : Avram::Operation.class | Avram::SaveOperation.class) : Bool + nested?(operation.param_key).any? + end end