Class: SexpPath::Matcher::All
- Defined in:
- lib/sexp_path/matcher/all.rb
Overview
See SexpQueryBuilder.all
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(*options) ⇒ All
constructor
Create an All matcher which will match all of the
options
. - #inspect ⇒ Object
-
#satisfy?(o, data = {}) ⇒ Boolean
Satisfied when all sub expressions match
o
.
Methods inherited from Base
Methods included from Traverse
#capture_as, #replace_sexp, #search, #search_each
Constructor Details
#initialize(*options) ⇒ All
Create an All matcher which will match all of the options
.
6 7 8 |
# File 'lib/sexp_path/matcher/all.rb', line 6 def initialize(*) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/sexp_path/matcher/all.rb', line 3 def @options end |
Instance Method Details
#inspect ⇒ Object
17 18 19 |
# File 'lib/sexp_path/matcher/all.rb', line 17 def inspect .map{|o| o.inspect}.join(' & ') end |
#satisfy?(o, data = {}) ⇒ Boolean
Satisfied when all sub expressions match o
11 12 13 14 15 |
# File 'lib/sexp_path/matcher/all.rb', line 11 def satisfy?(o, data={}) return nil unless .all?{|exp| exp.is_a?(Sexp) ? exp.satisfy?(o, data) : exp == o} capture_match o, data end |