Module: Azeroth::Resourceable::ClassMethods

Defined in:
lib/azeroth/resourceable/class_methods.rb

Overview

Class methods added by Azeroth::Resourceable

Author:

  • Darthjee

Instance Method Summary collapse

Instance Method Details

#resource_for(name, **options) ⇒ Array<MethodDefinition>

Adds resource methods for resource

Examples:

Controller without delete

class DocumentsController < ApplicationController
  include Azeroth::Resourceable

  resource_for :document, except: :delete
end

Controller with only create, show and list

class DocumentsController < ApplicationController
  include Azeroth::Resourceable

  resource_for :document, only: %w[create index show]
end

Parameters:

  • name (String, Symbol)

    Name of the resource

Returns:

  • (Array<MethodDefinition>)

    list of methods created

See Also:



33
34
35
36
37
# File 'lib/azeroth/resourceable/class_methods.rb', line 33

def resource_for(name, **options)
  Builder.new(
    self, name, Azeroth::Options.new(options)
  ).build
end