Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Next Release
* [#1038](https://github.com/intridea/grape/pull/1038): Avoid dup-ing the String class when used in inherited params - [@rnubel](https://github.com/rnubel).
* [#1042](https://github.com/intridea/grape/issues/1042): Fix coercion of complex arrays - [@dim](https://github.com/dim).
* [#1045](https://github.com/intridea/grape/pull/1045): Do not convert `Rack::Response` to `Rack::Response` in middleware - [@dmitry](https://github.com/dmitry).
* [#1048](https://github.com/intridea/grape/pull/1048): Only dup `InheritableValues`, remove support for `deep_dup` - [@toddmazierski](https://github.com/toddmazierski/)

0.12.0 (6/18/2015)
==================
Expand Down
49 changes: 0 additions & 49 deletions lib/backports/active_support/deep_dup.rb

This file was deleted.

97 changes: 0 additions & 97 deletions lib/backports/active_support/duplicable.rb

This file was deleted.

8 changes: 0 additions & 8 deletions lib/grape.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
require 'set'
require 'active_support/version'
require 'active_support/core_ext/hash/indifferent_access'

if ActiveSupport::VERSION::MAJOR >= 4
require 'active_support/core_ext/object/deep_dup'
else
require_relative 'backports/active_support/deep_dup'
end
require_relative 'backports/active_support/duplicable'

require 'active_support/ordered_hash'
require 'active_support/core_ext/object/conversions'
require 'active_support/core_ext/array/extract_options'
Expand Down
2 changes: 1 addition & 1 deletion lib/grape/util/inheritable_values.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def to_hash
def initialize_copy(other)
super
self.inherited_values = other.inherited_values
self.new_values = other.new_values.deep_dup
self.new_values = other.new_values.dup
end

protected
Expand Down
13 changes: 10 additions & 3 deletions spec/grape/util/inheritable_values_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,16 @@ module Util
end

describe '#clone' do
it 'clones itself even when containing a String class' do
subject[:foo] = String
expect(subject.clone.to_hash).to eq(foo: String)
let(:obj_cloned) { subject.clone }

context 'complex (i.e. not primitive) data types (ex. entity classes, please see bug #891)' do
let(:description) { { entity: double } }

before { subject[:description] = description }

it 'copies values; does not duplicate them' do
expect(obj_cloned[:description]).to eq description
end
end
end
end
Expand Down