module Migajas

Constants

VERSION

Public Instance Methods

breadcrumbs() click to toggle source

Public: List of breadcrumbs encountered in this request. Add to this list any breadcrumb as you go through your routing tree in the app:

Example

define do
  breadcrumbs << "Home"

  on "users" do
    breadcrumbs << "Users"

    on get do
      # render the list
    end

    on ":id" do |id|
      user = User[id]
      breadcrumbs << user.name

      # etc
    end
  end
end

This will automatically build a list with the following breadcrumbs:

[
  Migajas::Crumb.new("Home", "/"),
  Migajas::Crumb.new("Users", "/users"),
  Migajas::Crumb.new("Profile", "/users/5")
]

In the view you can, then:

<% breadcrumbs.each do |crumb| %>
  <li class="<%= "active" if crumb.current? %>">
    <a href="<%= crumb.url %>"><%= crumb.name %></a>
  </li>
<% end %>

Returns a Migajas::Trail.

migajas_env() click to toggle source

Public: Reader method to get the Rack env. Override if your framework does not expose an `env` method in the context used when evaluating routing actions or views (such as Rails).

# File lib/migajas.rb, line 8
def migajas_env
  env
end