class

ActiveSupport::ArrayInquirer

v7.1.3.4 - Show latest stable - Superclass: Array

Array Inquirer

Wrapping an array in an ArrayInquirer gives a friendlier way to check its string-like contents:

variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])

variants.phone?    # => true
variants.tablet?   # => true
variants.desktop?  # => false

Files

  • activesupport/lib/active_support/array_inquirer.rb