Class: Wovnrb::InputReplacer
- Inherits:
-
ReplacerBase
- Object
- ReplacerBase
- Wovnrb::InputReplacer
- Defined in:
- lib/wovnrb/html_replacers/input_replacer.rb
Instance Method Summary collapse
-
#initialize(text_index) ⇒ InputReplacer
constructor
A new instance of InputReplacer.
- #replace(dom, lang) ⇒ Object
Constructor Details
#initialize(text_index) ⇒ InputReplacer
Returns a new instance of InputReplacer.
3 4 5 |
# File 'lib/wovnrb/html_replacers/input_replacer.rb', line 3 def initialize(text_index) @text_index = text_index end |
Instance Method Details
#replace(dom, lang) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/wovnrb/html_replacers/input_replacer.rb', line 7 def replace(dom, lang) dom.xpath('//input').each do |node| next if wovn_ignore?(node) set_attribute('value', node, lang) if replaceable_value? node set_attribute('placeholder', node, lang) if replaceable_placeholder? node end end |