def resource(name, options = {}, &blk)
      Routing::Resource.new(self, name, options.merge(separator: @router.action_separator), &blk)
    end
def resource(name, options = {}, &blk)
      Routing::Resource.new(self, name, options.merge(separator: @router.action_separator), &blk)
    end
Defines a set of named routes for a single RESTful resource.
 It has a built-in integration for Hanami::Controller.

 @param name [String] the name of the resource
 @param options [Hash] a set of options to customize the routes
 @option options [Array<Symbol>] :only a subset of the default routes
   that we want to generate
 @option options [Array<Symbol>] :except prevent the given routes to be
   generated
 @param blk [Proc] a block of code to generate additional routes

 @return [Hanami::Routing::Resource]

 @since 0.1.0

 @see Hanami::Routing::Resource
 @see Hanami::Routing::Resource::Action
 @see Hanami::Routing::Resource::Options

 @example Default usage
   require 'hanami/router'

   Hanami::Router.new do
     resource 'identity'
   end

   # It generates:
   
   # +--------+----------------+-------------------+----------+----------------+
   # | Verb   | Path           | Action            | Name     | Named Route    |
   # +--------+----------------+-------------------+----------+----------------+
   # | GET    | /identity      | Identity::Show    | :show    | :identity      |
   # | GET    | /identity/new  | Identity::New     | :new     | :new_identity  |
   # | POST   | /identity      | Identity::Create  | :create  | :identity      |
   # | GET    | /identity/edit | Identity::Edit    | :edit    | :edit_identity |
   # | PATCH  | /identity      | Identity::Update  | :update  | :identity      |
   # | DELETE | /identity      | Identity::Destroy | :destroy | :identity      |
   # +--------+----------------+-------------------+----------+----------------+



 @example Limit the generated routes with :only
   require 'hanami/router'

   Hanami::Router.new do
     resource 'identity', only: [:show, :new, :create]
   end

   # It generates:
   
   # +--------+----------------+------------------+----------+----------------+
   # | Verb   | Path           | Action           | Name     | Named Route    |
   # +--------+----------------+------------------+----------+----------------+
   # | GET    | /identity      | Identity::Show   | :show    | :identity      |
   # | GET    | /identity/new  | Identity::New    | :new     | :new_identity  |
   # | POST   | /identity      | Identity::Create | :create  | :identity      |
   # +--------+----------------+------------------+----------+----------------+



 @example Limit the generated routes with :except
   require 'hanami/router'

   Hanami::Router.new do
     resource 'identity', except: [:edit, :update, :destroy]
   end

   # It generates:
   
   # +--------+----------------+------------------+----------+----------------+
   # | Verb   | Path           | Action           | Name     | Named Route    |
   # +--------+----------------+------------------+----------+----------------+
   # | GET    | /identity      | Identity::Show   | :show    | :identity      |
   # | GET    | /identity/new  | Identity::New    | :new     | :new_identity  |
   # | POST   | /identity      | Identity::Create | :create  | :identity      |
   # +--------+----------------+------------------+----------+----------------+



 @example Additional single routes
   require 'hanami/router'

   Hanami::Router.new do
     resource 'identity', only: [] do
       member do
         patch 'activate'
       end
     end
   end

   # It generates:
   
   # +--------+--------------------+--------------------+------+--------------------+
   # | Verb   | Path               | Action             | Name | Named Route        |
   # +--------+--------------------+--------------------+------+--------------------+
   # | PATCH  | /identity/activate | Identity::Activate |      | :activate_identity |
   # +--------+--------------------+--------------------+------+--------------------+



 @example Additional collection routes
   require 'hanami/router'

   Hanami::Router.new do
     resource 'identity', only: [] do
       collection do
         get 'keys'
       end
     end
   end

   # It generates:
   
   # +------+----------------+----------------+------+----------------+
   # | Verb | Path           | Action         | Name | Named Route    |
   # +------+----------------+----------------+------+----------------+
   # | GET  | /identity/keys | Identity::Keys |      | :keys_identity |
   # +------+----------------+----------------+------+----------------+