Class: I15R::PatternMatcher::ErbTransformer

Inherits:
Transformer
  • Object
show all
Defined in:
lib/i15r/pattern_matcher.rb

Instance Method Summary collapse

Methods inherited from Transformer

#initialize

Constructor Details

This class inherits a constructor from I15R::PatternMatcher::Transformer

Instance Method Details

#transform(match_data, match, line, translation_key) ⇒ Object



99
100
101
102
103
104
105
106
# File 'lib/i15r/pattern_matcher.rb', line 99

def transform(match_data, match, line, translation_key)
  return line if line.match /\bt\(/
  if match_data.to_s.index("<%")
    line.gsub(match, i18n_string(translation_key, match))
  else
    line.gsub(match, "<%= #{i18n_string(translation_key, match)} %>")
  end
end