class StateMachines::WhitelistMatcher
Matches a specific set of values
Public Instance Methods
description()
click to toggle source
A human-readable description of this matcher
# File lib/state_machines/matcher.rb, line 68 def description values.length == 1 ? values.first.inspect : values.inspect end
matches?(value, context = {})
click to toggle source
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
# File lib/state_machines/matcher.rb, line 63 def matches?(value, context = {}) values.include?(value) end