Sha256: 8c727cc2251783658346ae2d3a189dcba3b7b33eb26390d1dd8546cac90c31b3

Contents?: true

Size: 932 Bytes

Versions: 18

Compression:

Stored size: 932 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.namespace(base)}.routes"

        base.class_eval <<-END_EVAL, __FILE__, __LINE__
          private

          def routes
            #{factory}
          end
        END_EVAL
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
hanami-1.3.5 lib/hanami/action/routing_helpers.rb
hanami-1.3.4 lib/hanami/action/routing_helpers.rb
hanami-1.3.3 lib/hanami/action/routing_helpers.rb
hanami-1.3.2 lib/hanami/action/routing_helpers.rb
hanami-1.3.1 lib/hanami/action/routing_helpers.rb
hanami-1.3.0 lib/hanami/action/routing_helpers.rb
hanami-1.3.0.beta1 lib/hanami/action/routing_helpers.rb
hanami-1.2.0 lib/hanami/action/routing_helpers.rb
hanami-1.2.0.rc2 lib/hanami/action/routing_helpers.rb
hanami-1.2.0.rc1 lib/hanami/action/routing_helpers.rb
hanami-1.2.0.beta2 lib/hanami/action/routing_helpers.rb
hanami-1.2.0.beta1 lib/hanami/action/routing_helpers.rb
hanami-1.1.1 lib/hanami/action/routing_helpers.rb
hanami-1.1.0 lib/hanami/action/routing_helpers.rb
hanami-1.1.0.rc1 lib/hanami/action/routing_helpers.rb
hanami-1.1.0.beta3 lib/hanami/action/routing_helpers.rb
hanami-1.1.0.beta2 lib/hanami/action/routing_helpers.rb
hanami-1.1.0.beta1 lib/hanami/action/routing_helpers.rb