Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call to_hash on object that respond to to_hash + specs #169

Merged
merged 1 commit into from
Jun 12, 2014

Conversation

gregory
Copy link
Contributor

@gregory gregory commented Jun 12, 2014

No description provided.

@dblock
Copy link
Member

dblock commented Jun 12, 2014

This makes sense. Can you please pull out the specific test with a class that reponds to to_hash out in its own describe? Call the class something other than A, maybe ClassRespondsToToHash.

Update the CHANGELOG, please.

@@ -6,6 +6,7 @@

**Note:** This version introduces several backward incompatible API changes. See [UPGRADING](UPGRADING.md) for details.

* [#169](https://github.com/intridea/hashie/pull/169): call to_hash on object that respond to to_hash - [@gregory](https://github.com/gregory).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a very clear description. Really, what happens is when you call to_hash on a Hashie object, it will deep convert everything to a hash. Now, if you have an object that's not a Hash, but responds to to_hash, it will convert that too. I think this should read something like this: "Hash#to_hash will also convert nested objects that implement to_hash".

What do you think?

@dblock
Copy link
Member

dblock commented Jun 12, 2014

Can you please squash all these commits? Thx.

rename test class, wrap the tests on its own describe

update changelog

add spaces around hash

better changelog description
@gregory
Copy link
Contributor Author

gregory commented Jun 12, 2014

@dblock i'm trying to get that feature on 2.1.1, do you mind to create 2.1.2?

dblock added a commit that referenced this pull request Jun 12, 2014
call to_hash on object that respond to to_hash + specs
@dblock dblock merged commit 17090ac into hashie:master Jun 12, 2014
@dblock
Copy link
Member

dblock commented Jun 12, 2014

This is merged, thank you.

@dblock
Copy link
Member

dblock commented Jun 12, 2014

@gregory I cut 2.1.2, it's 2.1.1 with just this change. Note that 3.0 will fix a bunch of stringifying keys issues, but I am not ready to release that just yet.

@gregory
Copy link
Contributor Author

gregory commented Jun 12, 2014

awesome! thank you ;)

jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Feb 6, 2015
${RUBY_PKGPREFIX}-hashie2.

## 2.1.2 (5/12/2014)

* [#169](hashie/hashie#169): Hash#to_hash will also convert nested objects that implement `to_hash` - [@gregory](https://github.com/gregory).

## 2.1.1 (4/12/2014)

* [#144](hashie/hashie#144): Fixed regression invoking `to_hash` with no parameters - [@mbleigh](https://github.com/mbleigh).

## 2.1.0 (4/6/2014)

* [#134](hashie/hashie#134): Add deep_fetch extension for nested access - [@tylerdooling](https://github.com/tylerdooling).
* Removed support for Ruby 1.8.7 - [@dblock](https://github.com/dblock).
* Ruby style now enforced with Rubocop - [@dblock](https://github.com/dblock).
* [#138](hashie/hashie#138): Added Hashie::Rash, a hash whose keys can be regular expressions or ranges - [@epitron](https://github.com/epitron).
* [#131](hashie/hashie#131): Added IgnoreUndeclared, an extension to silently ignore undeclared properties at intialization - [@righi](https://github.com/righi).
* [#136](hashie/hashie#136): Removed Hashie::Extensions::Structure - [@markiz](https://github.com/markiz).
* [#107](hashie/hashie#107): Fixed excessive value conversions, poor performance of deep merge in Hashie::Mash - [@davemitchell](https://github.com/dblock), [@dblock](https://github.com/dblock).
* [#69](hashie/hashie#69): Fixed assigning multiple properties in Hashie::Trash - [@einzige](https://github.com/einzige).
* [#100](hashie/hashie#100): IndifferentAccess#store will respect indifference - [@jrochkind](https://github.com/jrochkind).
* [#103](hashie/hashie#103): Fixed support for Hashie::Dash properties that end in bang - [@thedavemarshall](https://github.com/thedavemarshall).
* [89](hashie/hashie#89): Do not respond to every method with suffix in Hashie::Mash, fixes Rails strong_parameters - [@Maxim-Filimonov](https://github.com/Maxim-Filimonov).
* [#110](hashie/hashie#110): Correctly use Hash#default from Mash#method_missing - [@ryansouza](https://github.com/ryansouza).
* [#120](hashie/hashie#120): Pass options to recursive to_hash calls - [@pwillett](https://github.com/pwillett).
* [#113](hashie/hashie#113): Fixed Hash#merge with Hashie::Dash - [@spencer1248](https://github.com/spencer1248).
* [#99](hashie/hashie#99): Hash#deep_merge raises errors when it encounters integers - [@defsprite](https://github.com/defsprite).
* [#133](hashie/hashie#133): Fixed Hash##to_hash with symbolize_keys - [@mhuggins](https://github.com/mhuggins).
* [#130](hashie/hashie#130): IndifferentAccess now works without MergeInitializer - [@npj](https://github.com/npj).
* [#111](hashie/hashie#111): Trash#translations correctly maps original to translated names - [@artm](https://github.com/artm).
* [#129](hashie/hashie#129): Added Trash#permitted_input_keys and inverse_translations - [@artm](https://github.com/artm).
jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Feb 6, 2015
## 3.4.0 (02/02/2014)

* [#271](hashie/hashie#271): Added ability to define defaults based on current hash - [@gregory](https://github.com/gregory).
* [#247](hashie/hashie#247): Fixed #stringify_keys and #symbolize_keys collision with ActiveSupport - [@bartoszkopinski](https://github.com/bartoszkopinski).
* [#249](hashie/hashie#249): SafeAssignment will now also protect hash-style assignments - [@jrochkind](https://github.com/jrochkind).
* [#251](hashie/hashie#251): Added block support to indifferent access #fetch - [@jgraichen](https://github.com/jgraichen).
* [#252](https://github.com/intridia/hashie/pull/252): Added support for conditionally required Hashie::Dash attributes - [@ccashwell](https://github.com/ccashwell).
* [#256](https://github.com/intridia/hashie/pull/256): Inherit key coercions - [@Erol](https://github.com/Erol).
* [#259](https://github.com/intridia/hashie/pull/259): Fixed handling of default proc values in Mash - [@Erol](https://github.com/Erol).
* [#260](https://github.com/intridia/hashie/pull/260): Added block support to Extensions::DeepMerge - [@Galathius](https://github.com/galathius).
* [#254](hashie/hashie#254): Added public utility methods for stringify and symbolize keys - [@maxlinc](https://github.com/maxlinc).
* [#261](hashie/hashie#261): Fixed bug where Dash.property modifies argument object - [@d_tw](https://github.com/d_tw).
* [#264](hashie/hashie#264): Methods such as abc? return true/false with Hashie::Extensions::MethodReader - [@Zloy](https://github.com/Zloy).
* [#269](hashie/hashie#269): Add #extractable_options? so ActiveSupport Array#extract_options! can extract it - [@ridiculous](https://github.com/ridiculous).
* Your contribution here.

## 3.3.2 (11/26/2014)

* [#233](hashie/hashie#233): Custom error messages for required properties in Hashie::Dash subclasses - [@Joss](https://github.com/joss).
* [#231](hashie/hashie#231): Added support for coercion on class type that inherit from Hash - [@gregory](https://github.com/gregory).
* [#228](hashie/hashie#228): Made Hashie::Extensions::Parsers::YamlErbParser pass template filename to ERB - [@jperville](https://github.com/jperville).
* [#224](hashie/hashie#224): Merging Hashie::Mash now correctly only calls the block on duplicate values - [@amysutedja](https://github.com/amysutedja).
* [#221](hashie/hashie#221): Reduce amount of allocated objects on calls with suffixes in Hashie::Mash - [@kubum](https://github.com/kubum).
* [#245](hashie/hashie#245): Added Hashie::Extensions::MethodAccessWithOverride to autoloads - [@Fritzinger](https://github.com/Fritzinger).

## 3.3.1 (8/26/2014)

* [#183](hashie/hashie#183): Added Mash#load with YAML file support - [@gregory](https://github.com/gregory).
* [#195](hashie/hashie#195): Ensure that the same object is returned after injecting IndifferentAccess - [@michaelherold](https://github.com/michaelherold).
* [#201](hashie/hashie#201): Hashie::Trash transforms can be inherited - [@FoboCasteR](https://github.com/fobocaster).
* [#189](hashie/hashie#189): Added Rash#fetch - [@medcat](https://github.com/medcat).
* [#200](hashie/hashie#200): Improved coercion: primitives and error handling - [@maxlinc](https://github.com/maxlinc).
* [#204](hashie/hashie#204): Added Hashie::Extensions::MethodOverridingWriter and Hashie::Extensions::MethodAccessWithOverride - [@michaelherold](https://github.com/michaelherold).
* [#205](http://github.com/intridea/hashie/pull/205): Added Hashie::Extensions::Mash::SafeAssignment - [@michaelherold](https://github.com/michaelherold).
* [#206](http://github.com/intridea/hashie/pull/206): Fixed stack overflow from repetitively including coercion in subclasses - [@michaelherold](https://github.com/michaelherold).
* [#207](http://github.com/intridea/hashie/pull/207): Fixed inheritance of transformations in Trash - [@FoboCasteR](https://github.com/fobocaster).
* [#209](http://github.com/intridea/hashie/pull/209): Added Hashie::Extensions::DeepFind - [@michaelherold](https://github.com/michaelherold).
* [#69](hashie/hashie#69): Fixed regression in assigning multiple properties in Hashie::Trash - [@michaelherold](https://github.com/michaelherold), [@einzige](https://github.com/einzige), [@dblock](https://github.com/dblock).

## 3.2.0 (7/10/2014)

* [#164](hashie/hashie#164), [#165](hashie/hashie#165), [#166](hashie/hashie#166): Fixed stack overflow when coercing mashes that contain ActiveSupport::HashWithIndifferentAccess values - [@numinit](https://github.com/numinit), [@kgrz](https://github.com/kgrz).
* [#177](hashie/hashie#177): Added support for coercing enumerables and collections - [@gregory](https://github.com/gregory).
* [#179](hashie/hashie#179): Mash#values_at will convert each key before doing the lookup - [@nahiluhmot](https://github.com/nahiluhmot).
* [#184](hashie/hashie#184): Allow ranges on Rash to match all Numeric types - [@medcat](https://github.com/medcat).
* [#187](hashie/hashie#187): Automatically require version - [@medcat](https://github.com/medcat).
* [#190](hashie/hashie#190): Fixed `coerce_key` with `from` Trash feature and Coercion extension - [@gregory](https://github.com/gregory).
* [#192](hashie/hashie#192): Fixed StringifyKeys#stringify_keys! to recursively stringify keys of embedded ::Hash types - [@dblock](https://github.com/dblock).

## 3.1.0 (6/25/2014)

* [#169](hashie/hashie#169): Hash#to_hash will also convert nested objects that implement to_hash - [@gregory](https://github.com/gregory).
* [#171](hashie/hashie#171): Include Trash and Dash class name when raising `NoMethodError` - [@gregory](https://github.com/gregory).
* [#172](hashie/hashie#172): Added Dash and Trash#update_attributes! - [@gregory](https://github.com/gregory).
* [#173](hashie/hashie#173): Auto include Dash::IndifferentAccess when IndiferentAccess is included in Dash - [@gregory](https://github.com/gregory).
* [#174](hashie/hashie#174): Fixed `from` and `transform_with` Trash features when IndifferentAccess is included - [@gregory](https://github.com/gregory).

## 3.0.0 (6/3/2014)

**Note:** This version introduces several backward incompatible API changes. See [UPGRADING](UPGRADING.md) for details.

* [#150](hashie/hashie#159): Handle nil intermediate object on deep fetch - [@stephenaument](https://github.com/stephenaument).
* [#146](hashie/hashie#146): Mash#respond_to? inconsistent with #method_missing and does not respond to #permitted? - [@dblock](https://github.com/dblock).
* [#152](hashie/hashie#152): Do not convert keys to String in Hashie::Dash and Hashie::Trash, use Hashie::Extensions::Dash::IndifferentAccess to achieve backward compatible behavior - [@dblock](https://github.com/dblock).
* [#152](hashie/hashie#152): Do not automatically stringify keys in Hashie::Hash#to_hash, pass `:stringify_keys` to achieve backward compatible behavior - [@dblock](https://github.com/dblock).
* [#148](hashie/hashie#148): Consolidated Hashie::Hash#stringify_keys implementation - [@dblock](https://github.com/dblock).
* [#149](hashie/hashie#149): Allow IgnoreUndeclared and DeepMerge to be used with undeclared properties - [@jhaesus](https://github.com/jhaesus).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants