Class: ExtractI18n::HTMLExtractor::Match::AttributeMatch
Instance Attribute Summary
Attributes inherited from BaseMatch
Attributes inherited from NodeMatch
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(document, node, text, attribute) ⇒ AttributeMatch
constructor
A new instance of AttributeMatch.
- #replace_text!(key, i18n_t) ⇒ Object
Methods inherited from NodeMatch
Constructor Details
#initialize(document, node, text, attribute) ⇒ AttributeMatch
Returns a new instance of AttributeMatch.
5 6 7 8 |
# 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 |
Class Method Details
.create(document, node, attribute) ⇒ Object
10 11 12 13 14 15 16 |
# 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 |
Instance Method Details
#replace_text!(key, i18n_t) ⇒ Object
18 19 20 21 |
# 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 |