vendor/bundle/gems/sexp_processor-4.11.0/lib/sexp.rb
##
# Recursively searches for the +pattern+ yielding each match, and
# replacing it with the result of the block.
#
Recursively searches for the +pattern+ yielding each match, and
replacing it with the result of the block.
Recursively searches for the + pattern + yielding each match and replacing it with the result of the block .
def replace_sexp pattern, &block 
    raise ArgumentError, "Needs a pattern" unless pattern.kind_of? Matcher
    return yield self if pattern.satisfy? self
    self.class.new(*self.map { |subset|
                     case subset
                     when Sexp then
                       subset.replace_sexp pattern, &block
                     else
                       subset
                     end
                   })
  end
def replace_sexp pattern , & block raise ArgumentError , "Needs a pattern" unless pattern . kind_of? Matcher return yield self if pattern . satisfy? self self . class . new ( * self . map { | subset | case subset when Sexp then subset . replace_sexp pattern , & block else subset end } ) end
Recursively searches for the +pattern+ yielding each match, and
replacing it with the result of the block.
Recursively searches for the + pattern + yielding each match and replacing it with the result of the block .
# TODO: rename to gsub? # TODO: Needs #new_from(*new_body) to copy file/line/comment
pattern
block