Method: StateMachines::WhitelistMatcher#matches?

Defined in:
lib/state_machines/matcher.rb

#matches?(value, _context = {}) ⇒ Boolean

Checks whether the given value exists within the whitelist configured for this matcher.

Examples

matcher = StateMachines::WhitelistMatcher.new([:parked, :idling])
matcher.matches?(:parked)       # => true
matcher.matches?(:first_gear)   # => false

Returns:

  • (Boolean)


66
67
68
# File 'lib/state_machines/matcher.rb', line 66

def matches?(value, _context = {})
  values.include?(value)
end