Sha256: 0c18efecfbc77ff1bb35d0515bf361beee655888b0606b5a63ed1081962f8dd2
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module Lotus module Helpers # Routing helper for full stack Lotus web applications. # # For a given application called <tt>Web::Application</tt>, at runtime # Lotus creates a routes factory called <tt>Web::Routes</tt>. # # By including this module in a view, it makes that factory avaliable as # <tt>routes</tt>. # # @since 0.1.0 # # @example Basic usage in template # require 'lotus' # # module Web::Views::Home # class Index # include Web::View # end # end # # # ERB template # # <%= routes.home_path %> # # @example Basic usage in view # require 'lotus' # # module Web::Views::Home # class Index # include Web::View # # def link_to_home # %(<a href="#{ routes.home_path }">Home</a>) # end # end # end # # # ERB template # # <%= link_to_home %> module RoutingHelper def self.included(base) factory = "#{ Utils::String.new(base).namespace }::Routes" base.class_eval <<-END_EVAL, __FILE__, __LINE__ def routes #{ factory } end END_EVAL end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lotus-helpers-0.2.6 | lib/lotus/helpers/routing_helper.rb |