class ExtractI18n::HTMLExtractor::Match::AttributeMatch

Public Class Methods

create(document, node, attribute) click to toggle source
# File lib/extract_i18n/html_extractor/match/attribute_match.rb, line 10
def self.create(document, node, attribute)
  if node[attribute] && !node[attribute].empty?
    [new(document, node, node[attribute], attribute)]
  else
    []
  end
end
new(document, node, text, attribute) click to toggle source
Calls superclass method
# File lib/extract_i18n/html_extractor/match/attribute_match.rb, line 5
def initialize(document, node, text, attribute)
  super(document, node, text)
  @attribute = attribute
end

Public Instance Methods

replace_text!(key, i18n_t) click to toggle source
# File lib/extract_i18n/html_extractor/match/attribute_match.rb, line 18
def replace_text!(key, i18n_t)
  document.erb_directives[key] = i18n_t
  node[@attribute] = "@@=#{key}@@"
end