7even/vkontakte_api

Hashie::Mash#count Warning

kobel169 opened this issue · 1 comments

[2] pry(main)> @vk.wall.get(owner_id: -XXXXXXX, count: "5", filter: "owner")
D, [2017-05-21T16:45:15.893154 #23584] DEBUG -- : POST https://api.vk.com/method/wall.get?access_token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
D, [2017-05-21T16:45:15.893288 #23584] DEBUG -- : body: "count=5&filter=owner&owner_id=-XXXXXXX"
W, [2017-05-21T16:45:16.040857 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.041072 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.041188 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.042765 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.042874 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.042992 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.043539 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.043647 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.043807 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.044675 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.044769 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.044955 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.045654 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.045751 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-05-21T16:45:16.045839 #23584]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.

7even commented

This is expected behaviour - Hashie::Mash uses #method_missing to respond to methods named after the keys - so it can't handle keys like count (because a real #count method already exists and it is being called instead of the #method_missing). This is just a warning from the hashie gem to help you not to mess up. You can suppress it with Hashie.logger = Logger.new(nil) if it bothers you.

Another option would be to replace Hashie::Mash with custom value objects here, in vkontakte_api - but that would tie the gem code to the API format and require a new version release even after the smallest API change.