From 6fcaf59e1874a7c3d0c2c721c2892479f7636b87 Mon Sep 17 00:00:00 2001 From: Dave Lucia Date: Sat, 4 Jan 2025 13:16:16 -0500 Subject: [PATCH] Remove fucntion_exported? check for Keyword.validate!/2 Gnat already requires Elixir 1.14, so we're safe to remove --- .../pull_consumer/connection_options.ex | 44 ++++++------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/lib/gnat/jetstream/pull_consumer/connection_options.ex b/lib/gnat/jetstream/pull_consumer/connection_options.ex index c1fa17a..1b61600 100644 --- a/lib/gnat/jetstream/pull_consumer/connection_options.ex +++ b/lib/gnat/jetstream/pull_consumer/connection_options.ex @@ -16,36 +16,18 @@ defmodule Gnat.Jetstream.PullConsumer.ConnectionOptions do defstruct @enforce_keys - # Remove this hackery when we will support Elixir ~> 1.13 only. - if Kernel.function_exported?(Keyword, :validate!, 2) do - def validate!(connection_options) do - struct!( - __MODULE__, - Keyword.validate!(connection_options, [ - :connection_name, - :stream_name, - :consumer_name, - connection_retry_timeout: @default_retry_timeout, - connection_retries: @default_retries, - inbox_prefix: nil, - domain: nil - ]) - ) - end - else - def validate!(connection_options) do - struct!( - __MODULE__, - Keyword.merge( - [ - connection_retry_timeout: @default_retry_timeout, - connection_retries: @default_retries, - inbox_prefix: nil, - domain: nil - ], - connection_options - ) - ) - end + def validate!(connection_options) do + struct!( + __MODULE__, + Keyword.validate!(connection_options, [ + :connection_name, + :stream_name, + :consumer_name, + connection_retry_timeout: @default_retry_timeout, + connection_retries: @default_retries, + inbox_prefix: nil, + domain: nil + ]) + ) end end