Class: Sexp::Any
Overview
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
The collection of sub-matchers to match against.
Attributes inherited from Sexp
Instance Method Summary collapse
-
#==(o) ⇒ Object
:nodoc:.
-
#initialize(*options) ⇒ Any
constructor
Create an Any matcher which will match any of the
options
. -
#inspect ⇒ Object
:nodoc:.
-
#pretty_print(q) ⇒ Object
:nodoc:.
-
#satisfy?(o) ⇒ Boolean
Satisfied when any sub expressions match
o
.
Methods inherited from Matcher
#&, #-@, #/, #=~, #>>, #greedy?, match_subs=, match_subs?, parse, #|
Methods inherited from Sexp
#/, #=~, _, ___, all, any, #array_type?, atom, child, #compact, #deep_each, #depth, #each_of_type, #each_sexp, #find_and_replace_all, #find_node, #find_nodes, from_array, #gsub, include, #line_max, m, #map, #mass, #method_missing, #new, not?, #replace_sexp, #respond_to?, s, #search_each, #sexp_body, #sexp_body=, #sexp_type, #sexp_type=, #shift, #structure, #sub, t, #to_a
Constructor Details
#initialize(*options) ⇒ Any
Create an Any matcher which will match any of the options
.
953 954 955 |
# File 'lib/sexp.rb', line 953 def initialize * @options = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Sexp
Instance Attribute Details
#options ⇒ Object (readonly)
The collection of sub-matchers to match against.
948 949 950 |
# File 'lib/sexp.rb', line 948 def @options end |
Instance Method Details
#==(o) ⇒ Object
:nodoc:
966 967 968 |
# File 'lib/sexp.rb', line 966 def == o # :nodoc: super && self. == o. end |
#inspect ⇒ Object
:nodoc:
970 971 972 |
# File 'lib/sexp.rb', line 970 def inspect # :nodoc: .map(&:inspect).join(" | ") end |
#pretty_print(q) ⇒ Object
:nodoc:
974 975 976 977 978 979 980 |
# File 'lib/sexp.rb', line 974 def pretty_print q # :nodoc: q.group 1, "any(", ")" do q.seplist do |v| q.pp v end end end |
#satisfy?(o) ⇒ Boolean
Satisfied when any sub expressions match o
960 961 962 963 964 |
# File 'lib/sexp.rb', line 960 def satisfy? o .any? { |exp| Sexp === exp && exp.satisfy?(o) || exp == o } end |