Sha256: cfb042e49d08216ee203b88aba67321d9f5dbffd75ccffe5500f8f058a60be9e

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require "hanami/routing/resource"
require "hanami/routing/resources/action"

module Hanami
  module Routing
    # Set of RESTful resources routes
    # Implementation of Hanami::Router#resources
    #
    # @since 0.1.0
    #
    # @api private
    #
    # @see Hanami::Router#resources
    class Resources < Resource
      # Set of default routes
      #
      # @api private
      # @since 0.1.0
      self.actions = %i[index new create show edit update destroy]

      # Action class
      #
      # @api private
      # @since 0.1.0
      self.action = Resources::Action

      # Member action class
      #
      # @api private
      # @since 0.1.0
      self.member = Resources::MemberAction

      # Collection action class
      #
      # @api private
      # @since 0.1.0
      self.collection = Resources::CollectionAction

      # Return wildcard param between separators
      #
      # @api private
      # @since 0.4.0
      def wildcard_param(route_param = nil)
        "/:#{@router.inflector.singularize(route_param)}_id/"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hanami-router-2.0.0.alpha1 lib/hanami/routing/resources.rb