method
find
![Wide documentation Importance_3](https://d2vfyqvduarcvs.cloudfront.net/images/importance_3.png?1349367920)
find(p1 = v1)
public
Register or
log in
to add new notes.
tadman -
April 1, 2009
MattStopa -
March 11, 2012
rubynooby -
February 12, 2015
shimrra -
November 17, 2015
![Default_avatar_30](https://www.gravatar.com/avatar/b850a6cd0c0f8993fa152645ca9a7fbd?default=http://apidock.com/images/default_avatar_30.png&size=30)
1 thank
Returns the element, not block result
Enumerable#find will always return the element that is found, not the result of the block provided.
![Default_avatar_30](https://www.gravatar.com/avatar/bf2741e5fba213cd501b0c64fdffad3f?default=http://apidock.com/images/default_avatar_30.png&size=30)
0 thanks
![Default_avatar_30](https://www.gravatar.com/avatar/896df7496c63fcc89c1496efabff9e83?default=http://apidock.com/images/default_avatar_30.png&size=30)
0 thanks
Example is a Bug!
Why is the example showing the use of the #detect method and not #find? Boggles the mind!
![Default_avatar_30](https://www.gravatar.com/avatar/9dc627311a47671e2310060950dee4ff?default=http://apidock.com/images/default_avatar_30.png&size=30)
0 thanks
Find and Detech are the same
@rubynooby: #find and #detect are aliases of the same underlying method. You can use them interchangeably to provide additional readability to your code (find an element to use it or detect if an element is present to do something).
http://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-find