Class: JekyllLazyLoadImage::Translator
- Inherits:
-
Object
- Object
- JekyllLazyLoadImage::Translator
- Defined in:
- lib/jekyll-lazy-load-image/translator.rb
Instance Method Summary collapse
-
#initialize(document, site_config) ⇒ Translator
constructor
A new instance of Translator.
- #translate ⇒ Object
Constructor Details
#initialize(document, site_config) ⇒ Translator
Returns a new instance of Translator.
7 8 9 10 |
# File 'lib/jekyll-lazy-load-image/translator.rb', line 7 def initialize(document, site_config) @document = document @site_config = site_config end |
Instance Method Details
#translate ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/jekyll-lazy-load-image/translator.rb', line 12 def translate nokogiri_doc.xpath("//img").each do |node| next if ignore_node?(node) apply_lazy_image_setting(node) inject_class_attr(node) inject_additional_attrs(node) end nokogiri_doc.to_html end |