Sha256: 6c51d2a4ebfedd28253853a949ff1cf45b9fc9286e99d23d1a9d4d65c75cd8b7
Contents?: true
Size: 690 Bytes
Versions: 11
Compression:
Stored size: 690 Bytes
Contents
# frozen_string_literal: true module Glossarist module Utilities module CommonFunctions # Hash#transform_keys is not available in Ruby 2.4 # so we have to do this ourselves :( # symbolize hash keys def symbolize_keys(hash) result = {} hash.each_pair do |key, value| result[key.to_sym] = value end result end # Hash#slice is not available in Ruby 2.4 # so we have to do this ourselves :( # slice hash keys def slice_keys(hash, keys) result = {} keys.each do |key| result[key] = hash[key] if hash.key?(key) end result end end end end
Version data entries
11 entries across 11 versions & 2 rubygems