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



84
85
86
87
88
89
90
91
# File 'lib/i15r/pattern_matcher.rb', line 84

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