diff options
author | Bobby McDonald <BobbyMcWho@users.noreply.github.com> | 2020-01-13 16:22:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-13 16:22:07 -0500 |
commit | d2071d82a2ceb2513bc0ff9c827ab3bc2a80b072 (patch) | |
tree | 16d8e19f6f07ad6d2e8662ac270d8f5de5affe02 /lib/hashie/mash.rb | |
parent | a1fa33d4259079f434b6d0820562e670d446582f (diff) | |
parent | 6f79eb82f66952451dd972fbee08df169e2cfba6 (diff) | |
download | hashie-d2071d82a2ceb2513bc0ff9c827ab3bc2a80b072.tar.gz |
Merge pull request #510 from BobbyMcWho/fix-compact-definition
Only define compact on ruby >= 2.4
Diffstat (limited to 'lib/hashie/mash.rb')
-rw-r--r-- | lib/hashie/mash.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/hashie/mash.rb b/lib/hashie/mash.rb index 97d6fa6..658aded 100644 --- a/lib/hashie/mash.rb +++ b/lib/hashie/mash.rb @@ -173,12 +173,6 @@ module Hashie super(*keys.map { |key| convert_key(key) }) end - # Returns a new instance of the class it was called on, with nil values - # removed. - def compact - self.class.new(super) - end - # Returns a new instance of the class it was called on, using its keys as # values, and its values as keys. The new values and keys will always be # strings. @@ -340,6 +334,12 @@ module Hashie def transform_values(&blk) self.class.new(super(&blk)) end + + # Returns a new instance of the class it was called on, with nil values + # removed. + def compact + self.class.new(super) + end end with_minimum_ruby('2.5.0') do |