class ReplaceSharedStringAst
Attributes
Public Class Methods
new(shared_strings)
click to toggle source
# File src/simplify/replace_shared_strings.rb, line 5 def initialize(shared_strings) @shared_strings = shared_strings end
Public Instance Methods
map(ast)
click to toggle source
This is convoluted so as to always return the same shared string
# File src/simplify/replace_shared_strings.rb, line 11 def map(ast) return ast unless ast.is_a?(Array) return shared_string(ast) if ast[0] == :shared_string ast.each.with_index do |a, i| next unless a.is_a?(Array) if a[0] == :shared_string ast[i] = shared_string(a) else map(a) end end ast end