Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

The value of "count" fields is reported incorrectly #29

Open
wesnolte opened this Issue · 8 comments

9 participants

@wesnolte

Hashie::Mash values such as media.data.likes.count and media.data.comments.count are incorrect when retrieved using this notation. I can get the correct values when using media.data.likes[:count] so I suspect that "count" is a reserved keyword somewhere. I'm a bit of a ruby n00b but if someone can point me in the right direction I'll have a stab at fixing the code.

@rainchen

+1, count is a instance method of Hashie::Mash

@SebAshton

+1 on this

@lxxxvi

+1

@mattbornski

Just ran into this too. Bump.

@heatonjb
Owner

There's a discussion of this here intridea/hashie#119
It looks like the hashie people are going to raise an argumentException when a collision occurs. So we'll need to deal with above and probably create an alias for any arguments which collide e.g. count.

@michaelherold

I wanted to drop by to mention that Hashie 3.3.1 adds a new extension Hashie::Extensions::MethodAccessWithOverride that might be of use to you guys. Including it in a Hash will give you method-like access to your keys and will allow you to overwrite methods with those keys. It sounded like that's what you were looking for.

There's also a new SafeAssignment Mash extension that will raise an error if you try to overwrite a method with a key if you'd rather go that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.