Skip to content

Commit

Permalink
Remove HashFilter.transform_keys
Browse files Browse the repository at this point in the history
  • Loading branch information
tfausak committed Jan 9, 2016
1 parent 57807f2 commit c4b65ef
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
11 changes: 0 additions & 11 deletions lib/active_interaction/backports.rb
Expand Up @@ -64,15 +64,4 @@ def delete_with_details(attribute)
end
include Details unless method_defined?(:details)
end

class HashFilter # rubocop:disable Style/Documentation
# Required for Rails < 4.0.0.
def self.transform_keys(hash, &block)
return hash.transform_keys(&block) if hash.respond_to?(:transform_keys)

result = {}
hash.each_key { |key| result[block.call(key)] = hash[key] }
result
end
end
end
10 changes: 0 additions & 10 deletions spec/active_interaction/filters/hash_filter_spec.rb
Expand Up @@ -6,16 +6,6 @@
include_context 'filters'
it_behaves_like 'a filter'

context 'backports' do
describe '.transform_keys' do
it 'transforms keys' do
original = { 'key' => 'value' }
transformed = described_class.transform_keys(original, &:to_sym)
expect(transformed).to eql(key: 'value')
end
end
end

context 'with a nested nameless filter' do
let(:block) { proc { hash } }

Expand Down

0 comments on commit c4b65ef

Please sign in to comment.