Class: PufferPages::Liquid::Tags::Scope

Inherits:
Liquid::Block
  • Object
show all
Defined in:
lib/puffer_pages/liquid/tags/scope.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, tokens) ⇒ Scope

Returns a new instance of Scope.



6
7
8
9
10
11
12
13
# File 'lib/puffer_pages/liquid/tags/scope.rb', line 6

def initialize(tag_name, markup, tokens)
  @attributes = {}
  markup.scan(::Liquid::TagAttributes) do |key, value|
    @attributes[key] = value
  end

  super
end

Instance Method Details

#render(context) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/puffer_pages/liquid/tags/scope.rb', line 15

def render(context)
  context.stack do
    @attributes.each do |key, value|
      context[key] = context[value]
    end

    super
  end
end