class StateMachine::BlacklistMatcher
Matches everything but a specific set of values
Public Instance Methods
description()
click to toggle source
A human-readable description of this matcher
# File lib/state_machine/matcher.rb 96 def description 97 "all - #{values.length == 1 ? values.first.inspect : values.inspect}" 98 end
filter(values)
click to toggle source
Finds all values that are not within the blacklist configured for this matcher
# File lib/state_machine/matcher.rb 91 def filter(values) 92 values - self.values 93 end
matches?(value, context = {})
click to toggle source
Checks whether the given value exists outside the blacklist configured for this matcher.
Examples¶ ↑
matcher = StateMachine::BlacklistMatcher.new([:parked, :idling]) matcher.matches?(:parked) # => false matcher.matches?(:first_gear) # => true
# File lib/state_machine/matcher.rb 85 def matches?(value, context = {}) 86 !values.include?(value) 87 end