class Ruhoh::Routes

Public Class Methods

new(ruhoh) click to toggle source
# File lib/ruhoh/routes.rb, line 3
def initialize(ruhoh)
  @ruhoh = ruhoh
end

Public Instance Methods

all() click to toggle source

All available routes from pages. This is not cached because the page collections should manage their own cache invalidation strategy @returns[Hash map]

# File lib/ruhoh/routes.rb, line 21
def all
  routes = {}
  routable.each do |r|
    routes.merge!(@ruhoh.collection(r).routes)
  end
  routes
end
find(route) click to toggle source
# File lib/ruhoh/routes.rb, line 7
def find(route)
  routable.each do |r|
    next unless @ruhoh.collection(r).routes[route]
    return @ruhoh.collection(r).routes[route]
    break
  end

  nil
end
routable() click to toggle source
# File lib/ruhoh/routes.rb, line 29
def routable
   @ruhoh.collections.all.keep_if do |r|
      @ruhoh.collections.collection(r).include?(Ruhoh::Base::Routable) rescue false
    end
end