Class: Sexp::Not
Overview
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
The value to negate in the match.
Attributes inherited from Sexp
Instance Method Summary collapse
-
#==(o) ⇒ Object
:nodoc:.
-
#initialize(value) ⇒ Not
constructor
Creates a Matcher which will match any Sexp that does not match the
value
. -
#inspect ⇒ Object
:nodoc:.
-
#pretty_print(q) ⇒ Object
:nodoc:.
-
#satisfy?(o) ⇒ Boolean
Satisfied if a
o
does not match thevalue
.
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(value) ⇒ Not
Creates a Matcher which will match any Sexp that does not match the value
1047 1048 1049 |
# File 'lib/sexp.rb', line 1047 def initialize value @value = value end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Sexp
Instance Attribute Details
#value ⇒ Object (readonly)
The value to negate in the match.
1042 1043 1044 |
# File 'lib/sexp.rb', line 1042 def value @value end |
Instance Method Details
#==(o) ⇒ Object
:nodoc:
1051 1052 1053 |
# File 'lib/sexp.rb', line 1051 def == o # :nodoc: super && self.value == o.value end |
#inspect ⇒ Object
:nodoc:
1062 1063 1064 |
# File 'lib/sexp.rb', line 1062 def inspect # :nodoc: "not?(%p)" % [value] end |
#pretty_print(q) ⇒ Object
:nodoc:
1066 1067 1068 1069 1070 |
# File 'lib/sexp.rb', line 1066 def pretty_print q # :nodoc: q.group 1, "not?(", ")" do q.pp value end end |
#satisfy?(o) ⇒ Boolean
Satisfied if a o
does not match the value
1058 1059 1060 |
# File 'lib/sexp.rb', line 1058 def satisfy? o !(value.kind_of?(Sexp) ? value.satisfy?(o) : value == o) end |