Not in ruby but in ActiveSupport:
characters = ["Konata", "Kagami", "Tsukasa"]
"Konata".in?(characters) # => true
More Related Contents:
- Array#each vs. Array#map
- Group hashes by keys and sum the values
- What is the difference between map, each, and collect? [duplicate]
- How to convert Time format in ruby
- Regex for reverse match a string
- Ruby, Difference between exec, system and %x() or Backticks
- What is the difference or value of these block coding styles in Ruby?
- How to understand symbols in Ruby
- Ruby array access 2 consecutive(chained) elements at a time
- Look up all descendants of a class in Ruby
- What does &. (ampersand dot) mean in Ruby?
- Mixing keyword with regular arguments in Ruby?
- Block definition – difference between braces and do-end?
- Should Gemfile.lock be included in .gitignore?
- Get names of all files from a folder with Ruby
- cannot load such file — zlib even after using rvm pkg install zlib
- Extract a substring from a string in Ruby using a regular expression
- How to get rid of non-ascii characters in ruby
- How do you use global variables or constant values in Ruby?
- How to convert a string to a constant in Ruby?
- Super keyword in Ruby
- Regex to split BBCode into pieces
- How do I avoid trailing empty items being removed when splitting strings?
- How do I test a function with gets.chomp in it?
- What does the equal (‘=’) symbol do when put after the method name in a method definition?
- Why does “compass watch” say it cannot load sass/script/node (LoadError)?
- In Ruby why won’t `foo = true unless defined?(foo)` make the assignment?
- How to determine if a character is a Chinese character
- What does the unary question mark (?) operator do?
- Should I use alias or alias_method?