Class: Stencil::With

Inherits:
Block show all
Defined in:
lib/stencil/directives/base.rb

Instance Method Summary collapse

Methods inherited from Block

#add, #ended, #initialize, #inspect, #parsed

Methods inherited from Directive

#checked_render, create, #initialize, #inspect, #interpret, #parsed, #postrender, #pre_end, #prerender, register, #render_end

Constructor Details

This class inherits a constructor from Stencil::Block

Instance Method Details

#inspect_argsObject



197
198
199
# File 'lib/stencil/directives/base.rb', line 197

def inspect_args
  @path
end

#render(state) ⇒ Object



201
202
203
204
205
206
207
208
209
210
211
# File 'lib/stencil/directives/base.rb', line 201

def render(state)
  if state.data.access(@path).nil?
    return []
  else
    state.data.push_context(@path)
    res = super
    state.data.pop_context

    return res
  end
end

#setup_parameters(path) ⇒ Object



193
194
195
# File 'lib/stencil/directives/base.rb', line 193

def setup_parameters(path)
  @path = path
end