Sha256: 3db18f931764ee24573a19d9a95a63f65deb4f5d0d1a5e8feb327efe6a4e6413
Contents?: true
Size: 936 Bytes
Versions: 8
Compression:
Stored size: 936 Bytes
Contents
require 'hanami/utils/string' module Hanami module Action # Routing helper for full stack Hanami web applications. # # For a given application called <tt>Web::Application</tt>, at runtime # Hanami creates a routes factory called <tt>Web::Routes</tt>. # # Included by default in every controller. # # @since 0.3.2 # # @example Usage in controller # require 'hanami' # # module Web::Controllers::Protected # class Index # include Web::Action # # def call(params) # redirect_to routes.root_path # end # end # end module RoutingHelpers def self.included(base) factory = "#{Utils::String.new(base).namespace}.routes" base.class_eval <<-END_EVAL, __FILE__, __LINE__ private def routes #{factory} end END_EVAL end end end end
Version data entries
8 entries across 8 versions & 1 rubygems