Skip to content

Conversation

@kostya
Copy link
Contributor

@kostya kostya commented May 17, 2013

No description provided.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use, space.is_kind_of here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, to_x can raise NoMethodError by itself. may be here better check respond_to? instead of try except.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, using respond_to makes more sense if we don't want to catch that issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, respond_to not good because of method_missing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my limited tests, Hash seems to swallow NoMethodErrors from insiide to_h.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ruby -e 'x = Object.new; def x.to_int; self.aaa; end; [].take(x)'
-e:1:in `to_int': undefined method `aaa' for #<Object:0x000000026bff88> (NoMethodError)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants