def check_format(formats, input)
      formats.inject(true) do |result, (key, format)|
        format.call(input[key]) && result
      end
    end
def check_format(formats, input)
      formats.inject(true) do |result, (key, format)|
        format.call(input[key]) && result
      end
    end
Format is a lambda defined in the search method class which returns
 true or false.
 This allows for flexible format checking:
    e.g. regex for ip addresses and DateTime.parse calls for timestamps