Class: Alf::Predicate::Renamer

Inherits:
Sexpr::Rewriter
  • Object
show all
Defined in:
lib/alf/predicate/processors/renamer.rb

Instance Method Summary collapse

Instance Method Details

#on_identifier(sexpr) ⇒ Object


7
8
9
10
11
# File 'lib/alf/predicate/processors/renamer.rb', line 7

def on_identifier(sexpr)
  return sexpr unless new_name = options[:renaming][sexpr.name]
  return new_name if Sexpr===new_name
  [:identifier, new_name]
end

#on_native(sexpr) ⇒ Object

Raises:


19
20
21
# File 'lib/alf/predicate/processors/renamer.rb', line 19

def on_native(sexpr)
  raise NotSupportedError
end

#on_qualified_identifier(sexpr) ⇒ Object


13
14
15
16
17
# File 'lib/alf/predicate/processors/renamer.rb', line 13

def on_qualified_identifier(sexpr)
  return sexpr unless new_name = options[:renaming][sexpr.name]
  return new_name if Sexpr===new_name
  [:qualified_identifier, sexpr.qualifier, new_name]
end