Class: Azeroth::Decorator::Options Private
- Inherits:
-
Sinclair::Options
- Object
- Sinclair::Options
- Azeroth::Decorator::Options
- 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
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, override: true, reader: true }.freeze
Instance Method Summary collapse
-
#as ⇒ Symbol, String
private
key to use when exposing the field.
-
#decorator ⇒ NilClass, Decorator
private
Decorator class to decorate the value.
-
#decorator_defined? ⇒ TrueClass, FalseClass
private
Returns true when attribute must can be decorated.
-
#if ⇒ Proc, Symbol
private
conditional to be checked when exposing field.
Instance Method Details
#as ⇒ Symbol, 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
|
# File 'lib/azeroth/decorator/options.rb', line 23
|
#decorator ⇒ NilClass, 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
|
# File 'lib/azeroth/decorator/options.rb', line 47
|
#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
67 68 69 |
# File 'lib/azeroth/decorator/options.rb', line 67 def decorator_defined? decorator.is_a?(Class) end |
#if ⇒ Proc, 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
|
# File 'lib/azeroth/decorator/options.rb', line 32
|