Class: Sexp::Wild

Inherits:
Matcher show all
Defined in:
lib/sexp.rb

Overview

Matches any single item.

examples:

s(:a)           / s{ _ }    #=> [s(:a)]
s(:a, s(s(:b))) / s{ s(_) } #=> [s(s(:b))]

Constant Summary

Constants inherited from Sexp

UNASSIGNED

Instance Attribute Summary

Attributes inherited from Sexp

#comments, #file, #line

Instance Method Summary collapse

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, #initialize, #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

This class inherits a constructor from Sexp

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Sexp

Instance Method Details

#inspectObject

:nodoc:



897
898
899
# File 'lib/sexp.rb', line 897

def inspect # :nodoc:
  "_"
end

#pretty_print(q) ⇒ Object

:nodoc:



901
902
903
# File 'lib/sexp.rb', line 901

def pretty_print q # :nodoc:
  q.text "_"
end

#satisfy?(o) ⇒ Boolean

Matches any single element.

Returns:

  • (Boolean)


893
894
895
# File 'lib/sexp.rb', line 893

def satisfy? o
  true
end