lib/cfa/matcher.rb
# The constructor arguments are constraints to match on an element.
# All constraints are optional.
# All supplied constraints must match, so it is a conjunction.
# @param key           [Object,nil] if non-nil,
#   constrain to elements with the name "*key*"
# @param collection    [Object,nil] if non-nil,
#   constrain to elements with the name "*collection*[]"
# @param value_matcher [Object,Regexp,nil] if non-nil,
#   constrain to elements whose value is Object or matches Regexp
# @yieldparam blk_key   [Object]
# @yieldparam blk_value [Object]
# @yieldreturn      [Boolean] if the block is present,
#   constrain to elements for which the block(*blk_key*, *blk_value*)
#   returns true
The constructor arguments are constraints to match on an element.
All constraints are optional.
All supplied constraints must match, so it is a conjunction.
The constructor arguments are constraints to match on an element . All constraints are optional . All supplied constraints must match so it is a conjunction .
def key_match?(element, key)
      return true unless key
      element[:key] == key
    end
def key_match? ( element , key ) return true unless key element [ :key ] == key end
The constructor arguments are constraints to match on an element.
The constructor arguments are constraints to match on an element .
if the block is present, constrain to elements for which the block(*blk_key*, *blk_value*) returns true
if the block is present constrain to elements for which the block ( * blk_key * * blk_value * ) returns true
Boolean
element
<not_specific>
key
if non-nil, constrain to elements with the name "*key*"
if non - nil constrain to elements with the name " * key * "
collection
<not_specific>
if non-nil, constrain to elements with the name "*collection*[]"
if non - nil constrain to elements with the name " * collection * [] "
value_matcher
<not_specific>
if non-nil, constrain to elements whose value is Object or matches Regexp
if non - nil constrain to elements whose value is Object or matches Regexp
<not_specific>
None