Class: Azeroth::Decorator::Options Private

Inherits:
Sinclair::Options
  • Object
show all
Defined in:
lib/azeroth/decorator/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 for decorator

See Also:

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.

{
  as: nil,
  if: nil,
  decorator: true
}.freeze

Instance Method Summary collapse

Instance Method Details

#asSymbol, String

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.

key to use when exposing the field

when nil, the name of the field

Returns:

  • (Symbol, String)


# File 'lib/azeroth/decorator/options.rb', line 21

#decoratorNilClass, Decorator

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.

Decorator class to decorate the value

when false Azeroth::DummyDecorator will be used

when nil, a decorator will be infered from value::Decorator

Returns:



# File 'lib/azeroth/decorator/options.rb', line 45

#decorator_defined?TrueClass, FalseClass

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 true when attribute must can be decorated

when false, decoration happens through #as_json call on value

Returns:

  • (TrueClass, FalseClass)


65
66
67
# File 'lib/azeroth/decorator/options.rb', line 65

def decorator_defined?
  decorator.is_a?(Class)
end

#ifProc, 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.

conditional to be checked when exposing field

when conditional returns false, the field will not be exposed

when if is a Proc the proc will be used, when it is a Symbol or String this will be the name of the method called in the decorator to evaluate the condition

Returns:

  • (Proc, Symbol)


# File 'lib/azeroth/decorator/options.rb', line 30