Comments (13)
I think it shares about the same use-case as Trash.
from hashie.
Right, never really noticed Trash before.
It's kind of the same except its automatic and it's also recursive so nested hashes get re-mapped as well.
Worth keeping? I use it alot.
~ Tom
from hashie.
Not sure. Because of the similar use case, users might get confused about which one to choose. They are also fundamentally different in the way that you built upon Mash while Trash is a Dash—this might make the choice for users more difficult. More choice is not a good idea in my opinion. But it's up to Michael I guess
from hashie.
I agree, that it could get confusing, but when you get a response from an api with a hash that has five keys each with nested hashes and nested hashes deeper and every key is camelCased its a real pita to work with that, as well as add that translation definition to your subclassed Hashie::Trash object.
~ Tom
from hashie.
I had a feeling that your implementation had too much code, so I tried it my way. The resulting implementation is so trivial that it hardly warrants having it's own class in the Hashie library. Users can do this for themselves easily.
This implementation relies on my Mash fixes for recursive goodness from #6
from hashie.
you're right, that is a big simplification, thanks.
I also agree that this now seems to trivial to have as part of the core to hashie.
Question though, say I want to add this to two gems for convenience and then the case comes where I need both gems in the same project, is there going to be an issue when it comes to both gems requiring this extension?
Or when you do the require 'rash' does that load know that the other gems already loaded that library?
Thanks again, I appreciate your simplification of the problem and your solution is definitely much cleaner.
~ Tom
from hashie.
Ah, by the way is there no longer a requirement to override initializing_reader and convert value in the Hashie::Rash class (both method explicitly check for Hashie::Mash). Maybe they should use self.class ?
from hashie.
Good catch, I forgot about that. Yeah I think it's a Mash bug—they should use self.class
. Please file it as a separate issue. As for my Rash, I've fixed it with better tests (your initializing_reader test wasn't good because it was using the method directly)
from hashie.
Cool, I'll file that ticket and a patch hopefully when I get home tonight.
Thanks again,
~ Tom
from hashie.
Any opposition to me publishing a separate "rash" gem for this extension since its not really worth putting into hashie core so that i can effectively use this in multiple libraries without having to copy the file around?
not sure how the intridea guys feel about people publishing "hashie extension" gems ...
~ Tom
from hashie.
It's the world of opensource. You can do anything you want, you can even publish a "hashie-sucks" gem. It's not like they registered a trademark or something :)
from hashie.
Haha, I'd love to see hashie-sucks
. I do think that this isn't really a candidate for Hashie, but I'd be happy to link to your gem from the README once it's published. Closing since it's not going into Hashie.
from hashie.
I agree that this shouldn't go into the trunk after mislav proved how trivial it was...
I went ahead a created a tiny tiny gem called rash here: http://github.com/tcocca/rash
thanks again,
~ Tom
from hashie.
Related Issues (20)
- Problem flattening multiple nested properties via Trash HOT 3
- Release v. next HOT 2
- Integer key upsets Hashie::Mash with SymbolizeKeys extension HOT 16
- Slice doesn't work using symbols HOT 5
- I got in dev a failing test from master, how to properly setup? HOT 5
- RFC: Switch to Github Actions for CI HOT 3
- Multiple Trash properties that use the same key from a source hash HOT 3
- Undefined quiet method HOT 4
- New Release? HOT 3
- Behavior change in accessing Mash values in 5.0 release HOT 5
- [Informative] `deep_symbolize_keys` broken in Rails 7 with `Mash` HOT 7
- [Question] Why use :to_sym in Hashie::Mash#convert_key HOT 1
- Release version 5 HOT 1
- Memory leak possible HOT 5
- DeepMerge changes ActiveRecord instance HOT 2
- Trash warning when translating string to symbol
- Mash.load is insecure HOT 5
- Including MethodAccessWithOverride in Hashie::Mash breaks dup method
- PredefinedValues is undefined ... :( HOT 1
- Can't call to_hash with nested `Sequel::Postgres::JSONBHash` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hashie.