Class: Azeroth::Options Private

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/azeroth/options.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Resource buiilding options

Author:

  • Darthjee

Constant Summary collapse

DEFAULT_OPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Default options

{
  only: i[create destroy edit index new show update],
  except: [],
  decorator: true
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Options

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Options.

Parameters:

  • options (Hash) (defaults to: {})

    hash with options (see DEFAULT_OPTIONS)

Options Hash (options):

  • only (Array<Symbol,String>)

    List of actions to be built

  • except (Array<Symbol,String>)

    List of actions to not to be built

  • decorator (Azeroth::Decorator, TrueClass, FalseClass)

    Decorator class or flag allowing/disallowing decorators



23
24
25
26
27
# File 'lib/azeroth/options.rb', line 23

def initialize(options = {})
  check_options(options)

  super(DEFAULT_OPTIONS.merge(options))
end

Instance Method Details

#actionsArray<Symbol>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Actions to be built

Returns:

  • (Array<Symbol>)


32
33
34
# File 'lib/azeroth/options.rb', line 32

def actions
  [only].flatten.map(&:to_sym) - [except].flatten.map(&:to_sym)
end