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
Implemented a new feature that Hashie::Mash.load accepts a Pathname object #331 #337
Conversation
089a0f8
to
3d3282e
Compare
This code is good. I want to leave this open for others to comment, in theory the caller can just do |
@dblock thank you very much for taking your time to review the code. I hope to see others' feedbacks or opinions. |
@gipcompany why do you feel that we need to be able to handle Pathname objects instead of a plain string? |
The only thing I'm not a fan of is the switching based on class. An alternative to this would be to just always call
This doesn't break the current implementation and allows you to use Pathname or any other type of file pointer that responds to |
The issue with things like |
To bad this didn't get merged. I subclass Mash just to get this... o well. I also don't understand the argument about passing garbage in. If it resolves to an existing filename, then apparently it isn't garbage, and in the end the user chooses what they pass in... and as far as I'm concerned it's their responsibility not to pass in "garbage" that resolves to "/etc/shadow". In any case files here should be opened read only, so what's the security implication? I think it makes sense that code that operates on files can at least take in Pathname instead of a string. But personally why not everything that responds to #to_str, since it's up to the user to send something sensible in. If you want to be sure that it is a path, and not garbage, it's a small fix: path.kind_of?( Pathname ) and path = path.to_s |
@@ -4,8 +4,10 @@ | |||
* [#319](https://github.com/intridea/hashie/pull/319): Fix a regression from 3.4.1 where `Hashie::Extensions::DeepFind` is no longer indifference-aware - [@michaelherold](https://github.com/michaelherold). | |||
* [#240](https://github.com/intridea/hashie/pull/240): Fixed nesting twice with Clash keys - [@bartoszkopinski](https://github.com/bartoszkopinski). | |||
* [#322](https://github.com/intridea/hashie/pull/322): Fixed `reverse_merge` issue with `Mash` subclasses - [@marshall-lee](https://github.com/marshall-lee). | |||
* [#337](https://github.com/intridea/hashie/pull/337): Implemented a new feature that Hashie::Mash.load accepts a Pathname object #331 - [@gipcompany](https://github.com/gipcompany). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just say Hashie::Mash.load
accepts a Pathname
, remove "implemented a new feature" and "object", quote everything that's code.
@najamelan I think you're right, and I am ok with the code as it stands. @michaelherold LMK how you feel about this?
|
This should be rebased, build fixed. |
LGTM. 👍 |
@gipcompany sorry for the delay, see above, would appreciate if you could help wrap this up |
@dblock Thanks |
@dblock let me see. I would like to catch up with the current status. Should I resolve this PR not to be conflicted and re-push it? |
Lets fix the build. ActiveSupport 5 is in the way now I think with older rubies, just add |
@@ -12,7 +12,7 @@ scheme are considered to be bugs. | |||
|
|||
### Added | |||
|
|||
* Nothing yet. | |||
* [#337](https://github.com/intridea/hashie/pull/337): Implemented a new feature that Hashie::Mash.load accepts a Pathname object #331 - [@gipcompany](https://github.com/gipcompany). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should say "Hashie::Mash.load
accepts a Pathname
- ...". This is too verbose otherwise :)
Try to |
6137e57
to
7a7d2e3
Compare
7a7d2e3
to
39590fc
Compare
12b70e8
to
23809c9
Compare
Merged via bbafade. |
Wow, this being merged in public is my first time experience. Thank you everyone for each support and thank you, @dblock for your continuous support. |
Also hashes in commits that contain dictionary words, like |
I'm sorry to arrive a bit late with this, but as I'm implementing something similar, I came to the following conclusion:
|
You have some good points @najamelan, feel free to PR an update! |
[3.4.6]: hashie/hashie@v3.4.5...v3.4.6 ### Fixed * [#368](hashie/hashie#368): Since `hashie/mash` can be required alone, require its dependencies - [@jrafanie](https://github.com/jrafanie). ## [3.4.5] - 2016-09-16 [3.4.5]: hashie/hashie@v3.4.4...v3.4.5 ### Added * [#337](hashie/hashie#337), [#331](hashie/hashie#331): `Hashie::Mash#load` accepts a `Pathname` object - [@gipcompany](https://github.com/gipcompany). ### Deprecated * [#366](hashie/hashie#366): Hashie is no longer tested on Ruby < 2 - [@dblock](https://github.com/dblock). ### Fixed * [#358](hashie/hashie#358): Fixed support for Array#dig - [@modosc](https://github.com/modosc). * [#365](hashie/hashie#365): Ensured ActiveSupport::HashWithIndifferentAccess is defined before use in #deep_locate - [@mikejarema](https://github.com/mikejarema). ### Miscellanous * [#366](hashie/hashie#366): Added Danger, PR linter - [@dblock](https://github.com/dblock). ## [3.4.4] - 2016-04-29 [3.4.4]: hashie/hashie@v3.4.3...v3.4.4 ### Added * [#349](hashie/hashie#349): Convert `Hashie::Mash#dig` arguments for Ruby 2.3.0 - [@k0kubun](https://github.com/k0kubun). ### Fixed * [#240](hashie/hashie#240): Fixed nesting twice with Clash keys - [@bartoszkopinski](https://github.com/bartoszkopinski). * [#317](hashie/hashie#317): Ensure `Hashie::Extensions::MethodQuery` methods return boolean values - [@michaelherold](https://github.com/michaelherold). * [#319](hashie/hashie#319): Fix a regression from 3.4.1 where `Hashie::Extensions::DeepFind` is no longer indifference-aware - [@michaelherold](https://github.com/michaelherold). * [#322](hashie/hashie#322): Fixed `reverse_merge` issue with `Mash` subclasses - [@marshall-lee](https://github.com/marshall-lee). * [#346](hashie/hashie#346): Fixed `merge` breaking indifferent access - [@docwhat](https://github.com/docwhat), [@michaelherold](https://github.com/michaelherold). * [#350](hashie/hashie#350): Fixed from string translations used with `IgnoreUndeclared` - [@marshall-lee](https://github.com/marshall-lee).
#331