[EDIT] (Thanks to the comment from Sergio Tulentsev) This is only relevant for longer arrays, more than about 10 elements, not in the exact case described by the OP. I include this answer for other users who may have longer arrays or lists of comparisons. [/EDIT]
If speed is also an issue: use a Set, which has a faster include? compared to Array:
# at the top, load this standard library (comes with Ruby):
require 'set'
# ...
if [b, c, d, e].to_set.include?(B)
SEE ALSO:
Array.include? is relatively slow. For lookups, use a set instead of a hash: https://stackoverflow.com/a/411164/967621
Speed comparisons for arrays, sets, and hashes, with benchmarks: Advantages of Set in ruby
elsif [b, c, d, e].include? BThis also depends what you mean by 'making more simple?' It might be that writing a case statement is better on a compiled level, etc....elsif; case(B); when b,c,d,e; ~~~~~; end; else; ~~~~; end;