Skip to content

Commit

Permalink
Use Symbol#name to minimize memory allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
skryukov committed Jan 2, 2025
1 parent 22eb21f commit d2edf21
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/alba.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ def stringify_keys!
# @return [Symbol, String, nil]
def regularize_key(key)
return if key.nil?
return key.to_sym if @symbolize_keys

@symbolize_keys ? key.to_sym : key.to_s
key.is_a?(Symbol) ? key.name : key.to_s
end

# Transform a key with given transform_type
Expand Down

0 comments on commit d2edf21

Please sign in to comment.