class Jekyll::AutoScout24::Entry

A drop in liquid is a class which allows you to export DOM like things to liquid. Methods of drops are callable. The main use for liquid drops is to implement lazy loaded objects. If you would like to make data available to the web designers which you don't want loaded unless needed then a drop is a great way to do that.

Attributes

node[R]

Public Class Methods

new(node) click to toggle source

ctor

# File lib/jekyll-autoscout24/backup_reader.rb, line 33
def initialize(node)
  @node = node
end

Public Instance Methods

liquid_method_missing(name) click to toggle source

Catch all method to be flexible and adaptable based on the XML structure provided.

# File lib/jekyll-autoscout24/backup_reader.rb, line 38
def liquid_method_missing(name)
  # lookup child node by name
  found = @node.locate(name).first
  # no match or empty node, therefore nil
  return nil if found.nil? || found.nodes.empty?
  # special processing for prices collection
  return Prices.new(found) if name == 'prices'
  # special processing for equipments collection
  return Equipments.new(found) if name == 'equipments'
  # special processing for images collection
  return Images.new(found) if name == 'images'
  # special processing for product_bookings collection
  return ProductBookings.new(found) if name == 'product_bookings'
  # either text or recurse
  found.text === nil ? Entry.new(found) : found.text
end