Code Monkey home page Code Monkey logo

Comments (5)

sdegutis avatar sdegutis commented on August 30, 2024

Looks like it's due to how it inherits from a Hash and only looks for missing methods. So any methods on Hash can't be used as keys. Could this be fixed or is it an inherent limitation due to the flexibility in accessing keys?

from figgy.

pd avatar pd commented on August 30, 2024

It's something I've been aware of, but never actually ran into in practice,
so I left it alone. And as you mention, you can always fall back to [] if
you have to.

If I switched to BasicObject and a private hash to do lookups, this could
be avoided. I do occasionally (ab?)use the enumerable properties exposed.
If I keep that, there's inevitably a set of keys that are simply
unavailable -- eg, product.price.each.

I'll hack at this in the next day or three.
On Apr 2, 2014 10:08 AM, "Steven Degutis" [email protected] wrote:

Looks like it's due to how it inherits from a Hash and only looks for
missing methodshttps://github.com/pd/figgy/blob/master/lib/figgy/hash.rb#L45-L50.
So any methods on Hash can't be used as keys. Could this be fixed or is it
an inherent limitation due to the flexibility in accessing keys?


Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-39341864
.

from figgy.

sdegutis avatar sdegutis commented on August 30, 2024

Yeah I've been using config[:size] which is a fine workaround, but the new inconsistency in my code is enough to drive me to help think of a solution.

from figgy.

sdegutis avatar sdegutis commented on August 30, 2024

Welp, I don't really see a way around it except for a lot more monkey-patching which doesn't seem like a great idea. Maybe the only thing to do is put something in the README as a warning.

from figgy.

pd avatar pd commented on August 30, 2024

Yeah, added some caveats in the README and I'll just leave it at that. I have a lot of real-life-in-use-today code that likes the enumerability of figgy hashes.

from figgy.

Related Issues (2)

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.