Class: Mullet::HTML::UnlessElementRenderer

Inherits:
IfElementRenderer show all
Defined in:
lib/mullet/html/unless_element_renderer.rb

Overview

Renders an element if variable is false.

Constant Summary

Constants inherited from ElementRenderer

ElementRenderer::ATTRIBUTE_NAME_MISSING_ERROR, ElementRenderer::ATTRIBUTE_NAME_SEPARATOR, ElementRenderer::ATTRIBUTE_SEPARATOR, ElementRenderer::ATTRIBUTE_SYNTAX_ERROR, ElementRenderer::CONVENIENT_ATTRIBUTE_COMMANDS

Instance Attribute Summary

Attributes inherited from ElementRenderer

#remove_mode

Instance Method Summary collapse

Methods inherited from IfElementRenderer

#render, #super_render

Methods inherited from CommandElementRenderer

#has_command

Methods inherited from ElementRenderer

#add_attribute_command, #add_attribute_commands, #add_attribute_message_command, #add_attribute_message_commands, #configure_attribute_commands, #configure_attribute_message_commands, #configure_commands, #configure_content, #execute_attribute_commands, #has_command, #has_dynamic_content, #render, #render_content, #render_end_tag, #render_start_tag, #should_render_content, #should_render_tag

Methods included from Container

#add_child, #children, #clear_children, #delete_child, #render_children

Constructor Details

#initialize(element, variable_name) ⇒ UnlessElementRenderer

Constructor

Parameters:

  • element (Element)

    element to render

  • variable_name (String)

    name of variable containing condition



14
15
16
17
# File 'lib/mullet/html/unless_element_renderer.rb', line 14

def initialize(element, variable_name)
  super(element, variable_name)
  @variable_name = variable_name.to_sym()
end

Instance Method Details

#should_render_element(render_context) ⇒ Object



19
20
21
# File 'lib/mullet/html/unless_element_renderer.rb', line 19

def should_render_element(render_context)
  return !super
end