Class: Azeroth::Options Private
- Inherits:
-
Sinclair::Options
- Object
- Sinclair::Options
- Azeroth::Options
- 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
Constant Summary collapse
- DEFAULT_OPTIONS =
Default options
{ only: %i[create destroy edit index new show update], except: [], decorator: true, before_save: nil, build_with: nil }.freeze
Instance Method Summary collapse
-
#actions ⇒ Array<Symbol>
private
Actions to be built.
-
#before_save ⇒ Symbol, Proc
private
Block or method name to be run before save.
-
#build_with ⇒ Symbol, Proc
private
Block or method name to be ran when building the resource.
-
#decorator ⇒ Decorator, ...
private
decorator class to be used.
-
#event_dispatcher(event) ⇒ Jace::Dispatcher
private
Returns event dispatcher.
-
#except ⇒ Array<String,Symbol>
private
actions to be ignored.
-
#only ⇒ Array<String,Symbol>
private
filter of only actions to be built.
Instance Method Details
#actions ⇒ Array<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
30 31 32 |
# File 'lib/azeroth/options.rb', line 30 def actions [only].flatten.map(&:to_sym) - [except].flatten.map(&:to_sym) end |
#before_save ⇒ Symbol, Proc
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.
Block or method name to be run before save
The given method or block will be ran before committing changes in models to database
|
|
# File 'lib/azeroth/options.rb', line 73
|
#build_with ⇒ Symbol, Proc
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.
Block or method name to be ran when building the resource
|
|
# File 'lib/azeroth/options.rb', line 84
|
#decorator ⇒ 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 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
|
|
# File 'lib/azeroth/options.rb', line 61
|
#event_dispatcher(event) ⇒ Jace::Dispatcher
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 event dispatcher
Event dispatcher is responsible for sending events such as before_save to it’s correct calling point
41 42 43 44 45 |
# File 'lib/azeroth/options.rb', line 41 def event_dispatcher(event) Jace::Dispatcher.new( before: try("before_#{event}") ) end |
#except ⇒ Array<String,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 ignored
|
|
# File 'lib/azeroth/options.rb', line 54
|
#only ⇒ Array<String,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.
filter of only actions to be built
|
|
# File 'lib/azeroth/options.rb', line 47
|