GithubHelp home page GithubHelp logo

Comments (13)

mislav avatar mislav commented on June 22, 2024

I think it shares about the same use-case as Trash.

from hashie.

tcocca avatar tcocca commented on June 22, 2024

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.

mislav avatar mislav commented on June 22, 2024

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.

tcocca avatar tcocca commented on June 22, 2024

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.

mislav avatar mislav commented on June 22, 2024

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.

tcocca avatar tcocca commented on June 22, 2024

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.

tcocca avatar tcocca commented on June 22, 2024

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.

mislav avatar mislav commented on June 22, 2024

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.

tcocca avatar tcocca commented on June 22, 2024

Cool, I'll file that ticket and a patch hopefully when I get home tonight.

Thanks again,
~ Tom

from hashie.

tcocca avatar tcocca commented on June 22, 2024

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.

mislav avatar mislav commented on June 22, 2024

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.

mbleigh avatar mbleigh commented on June 22, 2024

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.

tcocca avatar tcocca commented on June 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.