Class: RocketNavigation::Renderer::Json

Inherits:
Base
  • Object
show all
Defined in:
lib/rocket_navigation/renderer/json.rb

Overview

Renders the navigation items as a object tree serialized as a json string, can also output raw ruby Hashes

Instance Attribute Summary

Attributes inherited from Base

#container, #options

Instance Method Summary collapse

Methods inherited from Base

#active_tag_for, #base_item_html, #base_link_html, #consider_sub_navigation?, #container_html, #container_options, #expand_all?, #expand_sub_navigation?, #include_sub_navigation?, #initialize, #item_classes, #item_extra_classes, #item_html, #item_options, #level, #link_classes, #link_extra_classes, #link_html, #link_options, #render_sub_navigation_for, #selected_class, #skip_if_empty?, #suppress_link?, #suppressed_tag_for, #tag_for

Constructor Details

This class inherits a constructor from RocketNavigation::Renderer::Base

Instance Method Details

#render(item_container) ⇒ Object



8
9
10
11
# File 'lib/rocket_navigation/renderer/json.rb', line 8

def render(item_container)
  results = hash_render(item_container)
  options[:as_hash] ? results : results.to_json
end