Method: Fast.replace_sql

Defined in:
lib/fast/sql.rb

.replace_sql(pattern, ast, &replacement) ⇒ Object

Fast.replace_sql(‘ival’, Fast.parse_sql(‘select 1’), &->(node){ replace(node.location.expression, ‘2’) }) # => “select 2”

Returns:

  • string with the sql content updated in case the pattern matches.

See Also:

  • SQLRewriter


25
26
27
# File 'lib/fast/sql.rb', line 25

def replace_sql(pattern, ast, &replacement)
  SQL.replace(pattern, ast, &replacement)
end