Sha256: 0f27632ba8ac49a8af282037751dbe8726cfde88ac12c7deb03d95374c35087e

Contents?: true

Size: 792 Bytes

Versions: 1

Compression:

Stored size: 792 Bytes

Contents

module Gretel
  module Crumbs
    class << self
      # Lay out the breadcrumbs.
      #
      # Example:
      #
      #   Gretel::Crumbs.layout do
      #     crumb :root do
      #       link "Home", root_path
      #     end
      #   end
      def layout(&block)
        # The URL helpers include needs to be done here because
        # Rails.application isn't set when this file is required
        # TODO: Can this be done otherwise?
        Gretel::Crumb.send :include, Rails.application.routes.url_helpers
        instance_eval &block
      end

      # Stores the supplied block for later use.
      def crumb(key, &block)
        crumbs[key] = block
      end

      # Returns an array of all stored crumb blocks.
      def crumbs
        @crumbs ||= {}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gretel-2.0.0.beta1 lib/gretel/crumbs.rb