class ExtractI18n::HTMLExtractor::Match::ErbDirectiveMatch

Constants

REGEXPS

Public Class Methods

create(document, fragment_id) click to toggle source
# File lib/extract_i18n/html_extractor/match/erb_directive_match.rb, line 24
def self.create(document, fragment_id)
  REGEXPS.map do |r|
    match = document.erb_directives[fragment_id].match(r[0])
    new(document, fragment_id, match[r[2]][1...-1], r) if match && match[r[2]]
  end
end
new(document, fragment_id, text, regexp) click to toggle source
Calls superclass method
# File lib/extract_i18n/html_extractor/match/erb_directive_match.rb, line 14
def initialize(document, fragment_id, text, regexp)
  super(document, text)
  @fragment_id = fragment_id
  @regexp = regexp
end

Public Instance Methods

replace_text!(key, i18n_t) click to toggle source
# File lib/extract_i18n/html_extractor/match/erb_directive_match.rb, line 20
def replace_text!(key, i18n_t)
  document.erb_directives[@fragment_id].gsub!(@regexp[0], @regexp[1] % i18n_t.strip)
end