| Class | StateMachine::WhitelistMatcher |
| In: |
lib/state_machine/matcher.rb
|
| Parent: | Matcher |
Matches a specific set of values
A human-readable description of this matcher
# File lib/state_machine/matcher.rb, line 70
70: def description
71: values.length == 1 ? values.first.inspect : values.inspect
72: end
Checks whether the given value exists within the whitelist configured for this matcher.
matcher = StateMachine::WhitelistMatcher.new([:parked, :idling]) matcher.matches?(:parked) # => true matcher.matches?(:first_gear) # => false
# File lib/state_machine/matcher.rb, line 65
65: def matches?(value, context = {})
66: values.include?(value)
67: end