Skip to content

Commit

Permalink
Swap out KeyTransform for CaseTransform (#1993)
Browse files Browse the repository at this point in the history
* delete KeyTransform, use CaseTransform

* added changelog

Conflicts:
	CHANGELOG.md
  • Loading branch information
NullVoxPopuli authored and bf4 committed Jan 6, 2017
1 parent 8832dd6 commit 4a184de
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 379 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Fixes:

Misc:

- [#1993](https://github.com/rails-api/active_model_serializers/pull/1993) Swap out KeyTransform for CaseTransform gem for the possibility of native extension use (@NullVoxPopuli)

### [v0.10.3 (2016-11-21)](https://github.com/rails-api/active_model_serializers/compare/v0.10.2...v0.10.3)

Fixes:
Expand Down
1 change: 1 addition & 0 deletions active_model_serializers.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Gem::Specification.new do |spec|
# 'thread_safe'

spec.add_runtime_dependency 'jsonapi', '0.1.1.beta2'
spec.add_runtime_dependency 'case_transform', '>= 0.2'

spec.add_development_dependency 'activerecord', rails_versions
# arel
Expand Down
4 changes: 2 additions & 2 deletions lib/active_model_serializers/adapter/base.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'active_model_serializers/key_transform'
require 'case_transform'

module ActiveModelSerializers
module Adapter
Expand Down Expand Up @@ -31,7 +31,7 @@ def self.transform(options)
# @param options [Object] serializable resource options
# @return [Symbol] the default transform for the adapter
def self.transform_key_casing!(value, options)
KeyTransform.send(transform(options), value)
CaseTransform.send(transform(options), value)
end

def self.cache_key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def parse_relationships(relationships, options)
# @api private
def transform_keys(hash, options)
transform = options[:key_transform] || :underscore
KeyTransform.send(transform, hash)
CaseTransform.send(transform, hash)
end
end
end
Expand Down
74 changes: 0 additions & 74 deletions lib/active_model_serializers/key_transform.rb

This file was deleted.

Loading

0 comments on commit 4a184de

Please sign in to comment.