Sha256: 3ab2789cc8267051b0a3bcf1c033db871872c2290d15e4dfd0ddd931ce4c41c6
Contents?: true
Size: 703 Bytes
Versions: 4
Compression:
Stored size: 703 Bytes
Contents
module SimpleNavigation module Renderer # Renders the navigation items as a object tree serialized as a json string, # can also output raw ruby Hashes class Json < SimpleNavigation::Renderer::Base def render(item_container) results = hash_render(item_container) options[:as_hash] ? results : results.to_json end private def hash_render(item_container) return nil unless item_container item_container.items.map do |item| { items: hash_render(item.sub_navigation), name: item.name, selected: item.selected?, url: item.url } end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems