Check the range belongings
c = -2..2
c.all? {|x| x>0} # => false: not all values are > 0
c.any? {|x| x>0} # => true: some values are > 0
c.none? {|x| x>2} # => true: no values are > 2
c.one? {|x| x>0} # => false: more than one value is > 0
c.one? {|x| x>2} # => false: no values are > 2
c.one? {|x| x==2} # => true: one value == 2
[1, 2, 3].all? # => true: no values are nil or false
[nil, false].any? # => false: no true values
[].none? # => true: no non-false, non-nil values
Related examples in the same category