You’re looking for include?
:
>> ['Cat', 'Dog', 'Bird'].include? 'Dog'
=> true
More Related Contents:
- how to i add objects to an array ? ruby
- How do I pick randomly from an array?
- How to sum array of numbers in Ruby?
- How to select unique elements
- How to find and return a duplicate value in array
- Array#each vs. Array#map
- How to split (chunk) a Ruby array into parts of X elements? [duplicate]
- How to find an item in array which has the most occurrences [duplicate]
- Find indices of elements that match a given condition
- Creating matrix with `Array.new(n, Array.new)`
- Difference between map and collect in Ruby?
- Create two-dimensional arrays and access sub-arrays in Ruby
- How do I search within an array of hashes by hash values in ruby?
- What is the best way to convert an array to a hash in Ruby
- Performance of Arrays and Hashes in Ruby
- Find key/value pairs deep inside a hash containing an arbitrary number of nested hashes and arrays
- Ruby method Array#
- Need to split arrays to sub arrays of specified size in Ruby [duplicate]
- In Ruby, why does Array.new(size, object) create an array consisting of multiple references to the same object?
- How to chunk an array in Ruby
- Ruby – Difference between Array#
- Sort an array according to the elements of another array
- Convert array of 2-element arrays into a hash, where duplicate keys append additional values
- How to count duplicates in Ruby Arrays
- How to sort an array in Ruby to a particular order?
- How do you add an array to another array in Ruby and not end up with a multi-dimensional result?
- Ruby: filter array by regex?
- Ruby array subtraction without removing items more than once
- Where is it legal to use ruby splat operator?
- How do I remove blank elements from an array?