Sha256: e5c3660ac14f43aca54aa86b3d0bf1e9338f641bdebebefdedee938070a2b0ad

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Azeroth
  # @api private
  # @author Darthjee
  #
  # Resource buiilding options
  #
  # @see https://www.rubydoc.info/gems/sinclair/1.6.4/Sinclair/Options
  #   Sinclair::Options
  class Options < Sinclair::Options
    # Default options
    DEFAULT_OPTIONS = {
      only: %i[create destroy edit index new show update],
      except: [],
      decorator: true
    }.freeze

    with_options DEFAULT_OPTIONS

    # Actions to be built
    #
    # @return [Array<Symbol>]
    def actions
      [only].flatten.map(&:to_sym) - [except].flatten.map(&:to_sym)
    end

    # @method only
    # @api private
    #
    # filter of only actions to be built
    #
    # @return [Array<String,Symbol>]

    # @method except
    # @api private
    #
    # actions to be ignored
    #
    # @return [Array<String,Symbol>]

    # @method decorator
    # @api private
    #
    # decorator class to be used
    #
    # when set as true/false, it either infer
    # the class (model_class::Decorator) or
    # do not use a decorator at all calling
    # model.as_json
    #
    # @return [Decorator,TrueClass,FalseClass]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
azeroth-0.6.5 lib/azeroth/options.rb
azeroth-0.6.4 lib/azeroth/options.rb
azeroth-0.6.3 lib/azeroth/options.rb