class StateMachine::Matcher

Provides a general strategy pattern for determining whether a match is found for a value. The algorithm that actually determines the match depends on the matcher in use.

Attributes

values[R]

The list of values against which queries are matched

Public Class Methods

new(values = []) click to toggle source

Creates a new matcher for querying against the given set of values

# File lib/state_machine/matcher.rb, line 12
def initialize(values = [])
  @values = values.is_a?(Array) ? values : [values] 
end

Public Instance Methods

filter(values) click to toggle source

Generates a subset of values that exists in both the set of values being filtered and the values configured for the matcher

# File lib/state_machine/matcher.rb, line 18
def filter(values)
  self.values & values
end