Skip to content

Commit

Permalink
Make #transform_keys a public method
Browse files Browse the repository at this point in the history
  • Loading branch information
wujibear committed Dec 17, 2022
1 parent db678c7 commit 68be114
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/cache_crispies/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ def self.file_hashes
).uniq.sort
end

# Sets a method or Proc to transform keys by
#
# @param proc [Proc] a Proc to execute on serializable keys
# @return [Proc] a Proc to execute on the keys
def self.transform_keys(proc = nil)
return @transform_keys if @transform_keys.present?

@transform_keys = proc
end

private

def self.file_hash
Expand Down Expand Up @@ -252,16 +262,6 @@ def self.merge(attribute = nil, with: nil)
end
private_class_method :merge

# Sets a method or Proc to transform keys by
#
# @param proc [Proc] a Proc to execute on serializable keys
# @return [Proc] a Proc to execute on the keys
def self.transform_keys(proc = nil)
return @transform_keys if @transform_keys.present?

@transform_keys = proc
end

# Transforms an attribute key using a specified Proc
#
# @param key [String] the key for an attribute
Expand Down

0 comments on commit 68be114

Please sign in to comment.