Class: SimpleNavigation::Renderer::Json

Inherits:
Base
  • Object
show all
Defined in:
lib/simple_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

#adapter, #options

Instance Method Summary collapse

Methods inherited from Base

#expand_all?, #include_sub_navigation?, #initialize, #level, #render_sub_navigation_for, #skip_if_empty?

Constructor Details

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

Instance Method Details

#render(item_container) ⇒ Object



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

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