class Buoys::Renderer
Public Class Methods
new(context, key, *args)
click to toggle source
# File lib/buoys/renderer.rb, line 5 def initialize(context, key, *args) @context = context @key = key @args = args Buoys::Loader.load_buoys_files end
Public Instance Methods
render()
click to toggle source
# File lib/buoys/renderer.rb, line 13 def render return [] unless @key buoy = Buoys::Buoy.new(@context, @key, *@args) build_links(buoy) end
Private Instance Methods
build_links(buoy)
click to toggle source
# File lib/buoys/renderer.rb, line 22 def build_links(buoy) links = buoy.links.dup links.unshift(*collect_previous_links(buoy)) links.last.mark_as_current! links end
collect_previous_links(buoy)
click to toggle source
# File lib/buoys/renderer.rb, line 31 def collect_previous_links(buoy) links = [] buoy = buoy.previous while buoy links.unshift(*buoy.links) buoy = buoy.previous end links end