Class: ExtractI18n::HTMLExtractor::Match::NodeMatch

Inherits:
Object
  • Object
show all
Defined in:
lib/extract_i18n/html_extractor/match/node_match.rb

Direct Known Subclasses

BaseMatch, ErbDirectiveMatch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document, text) ⇒ NodeMatch

Returns a new instance of NodeMatch.



7
8
9
10
# File 'lib/extract_i18n/html_extractor/match/node_match.rb', line 7

def initialize(document, text)
  @document = document
  @text = text
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



5
6
7
# File 'lib/extract_i18n/html_extractor/match/node_match.rb', line 5

def document
  @document
end

#keyObject



22
23
24
# File 'lib/extract_i18n/html_extractor/match/node_match.rb', line 22

def key
  @key ||= text.parameterize.underscore
end

#textObject (readonly)

Returns the value of attribute text.



5
6
7
# File 'lib/extract_i18n/html_extractor/match/node_match.rb', line 5

def text
  @text
end

Instance Method Details

#replace_text!Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/extract_i18n/html_extractor/match/node_match.rb', line 16

def replace_text!
  raise NotImplementedError
end

#translation_key_objectObject



12
13
14
# File 'lib/extract_i18n/html_extractor/match/node_match.rb', line 12

def translation_key_object
  "t('.#{key}')"
end