Class: PictureTag::Picture

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll_picture_tag.rb

Overview

This is the actual liquid tag, which provides the interface with Jekyll.

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, raw_params, tokens) ⇒ Picture

First jekyll initializes our class with a few arguments, of which we only care about the params (arguments passed to the liquid tag). Jekyll makes no attempt to parse them; they’re given as a string.



52
53
54
55
# File 'lib/jekyll_picture_tag.rb', line 52

def initialize(tag_name, raw_params, tokens)
  @raw_params = raw_params
  super
end

Instance Method Details

#render(context) ⇒ Object

Then jekyll calls the ‘render’ method and passes it a mostly undocumented context object, which appears to hold the entire site including its configuration and the parsed _data dir.



60
61
62
63
64
65
66
67
68
# File 'lib/jekyll_picture_tag.rb', line 60

def render(context)
  setup(context)

  if PictureTag.disabled?
    ''
  else
    PictureTag.output_class.new.to_s
  end
end