Module: Liquid::Tag::Disableable

Included in:
Include
Defined in:
lib/liquid/tag/disableable.rb

Instance Method Summary collapse

Instance Method Details

#disabled_error(context) ⇒ Object



14
15
16
17
18
19
# File 'lib/liquid/tag/disableable.rb', line 14

def disabled_error(context)
  # raise then rescue the exception so that the Context#exception_renderer can re-raise it
  raise DisabledError, "#{tag_name} #{parse_context[:locale].t('errors.disabled.tag')}"
rescue DisabledError => exc
  context.handle_error(exc, line_number)
end

#render_to_output_buffer(context, output) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/liquid/tag/disableable.rb', line 6

def render_to_output_buffer(context, output)
  if context.tag_disabled?(tag_name)
    output << disabled_error(context)
    return
  end
  super
end