module Metamorpher::Rewriter::Replacement

Public Instance Methods

replace(path, replacement) click to toggle source
# File lib/metamorpher/rewriter/replacement.rb, line 4
def replace(path, replacement)
  if path.empty?
    replacement.dup
  else
    Terms::Literal.new(
      name: name,
      children: children.map_at(path.first) { |e| e.replace(path.drop(1), replacement) }
    )
  end
end