Sha256: 645aea6a44f3c1a9138eaa82432000c0a5dc980b5395b567c7f5e6309c190466

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Azeroth
  module Resourceable
    # @api public
    # @author Darthjee
    #
    # Class methods added by {Resourceable}
    module ClassMethods
      # Adds resource methods for resource
      #
      # @param name [String, Symbol] Name of the resource
      # @param (see Options#initialize)
      # @option (see Options#initialize)
      #
      # @return [Array<MethodDefinition>] list of methods created
      #
      # @see Options
      #
      # @example Controller without delete
      #   class DocumentsController < ApplicationController
      #     include Azeroth::Resourceable
      #
      #     resource_for :document, except: :delete
      #   end
      #
      # @example Controller with only create, show and list
      #   class DocumentsController < ApplicationController
      #     include Azeroth::Resourceable
      #
      #     resource_for :document, only: %w[create index show]
      #   end
      def resource_for(name, **options)
        Builder.new(
          self, name, Azeroth::Options.new(options)
        ).build
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
azeroth-0.6.3 lib/azeroth/resourceable/class_methods.rb
azeroth-0.6.2 lib/azeroth/resourceable/class_methods.rb
azeroth-0.6.1 lib/azeroth/resourceable/class_methods.rb
azeroth-0.6.0 lib/azeroth/resourceable/class_methods.rb
azeroth-0.5.0 lib/azeroth/resourceable/class_methods.rb