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
12 def initialize(values = [])
13   @values = values.is_a?(Array) ? values : [values] 
14 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
18 def filter(values)
19   self.values & values
20 end