From 5a0782047236bcb2aec55e53c3247db4307d9600 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Fri, 2 Dec 2022 08:05:42 +0100 Subject: [PATCH] Fix compat with ruby < 2.5 --- lib/pg_ldap_sync.rb | 1 + lib/pg_ldap_sync/compat.rb | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 lib/pg_ldap_sync/compat.rb diff --git a/lib/pg_ldap_sync.rb b/lib/pg_ldap_sync.rb index 21a6185..8d0a5e0 100644 --- a/lib/pg_ldap_sync.rb +++ b/lib/pg_ldap_sync.rb @@ -1,4 +1,5 @@ require "pg_ldap_sync/application" +require "pg_ldap_sync/compat" require "pg_ldap_sync/version" module PgLdapSync diff --git a/lib/pg_ldap_sync/compat.rb b/lib/pg_ldap_sync/compat.rb new file mode 100644 index 0000000..24f7845 --- /dev/null +++ b/lib/pg_ldap_sync/compat.rb @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby + +class Hash + def transform_keys + map do |k, v| + [yield(k), v] + end.to_h + end unless method_defined? :transform_keys +end