Sha256: adb0e675fccdd3aab28815d4b1ac237fab73ca9b579627988fd906b7e662db4e

Contents?: true

Size: 813 Bytes

Versions: 5

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

module Buoys
  module Helper
    # Declare the breadcrumb which want to render in view.
    #
    # <%= buoy :help, true %>
    def buoy(key, *args)
      @_buoys_renderer = Buoys::Renderer.new(self, key, *args)
    end
    alias breadcrumb buoy

    # <% buoys.tap do |links| %>
    #   <% if links.any? %>
    #     <ul>
    #       <% links.each do |link| %>
    #         <li class="<%= link.class %>">
    #           <%= link_to link.text, link.url %>
    #         </li>
    #       <% end %>
    #     </ul>
    #   <% end %>
    # <% end %>
    def buoys
      buoys_renderer.render
    end
    alias breadcrumbs buoys

    def buoys_renderer
      @_buoys_renderer ||= Buoys::Renderer.new(self, nil) # rubocop:disable Naming/MemoizedInstanceVariableName
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
buoys-2.1.0 lib/buoys/helper.rb
buoys-2.0.2 lib/buoys/helper.rb
buoys-2.0.1 lib/buoys/helper.rb
buoys-2.0.0 lib/buoys/helper.rb
buoys-1.1.0 lib/buoys/helper.rb