Module: Serega::Plugins::Preloads
- Defined in:
- lib/serega/plugins/preloads/preloads.rb,
lib/serega/plugins/preloads/lib/enum_deep_freeze.rb,
lib/serega/plugins/preloads/lib/main_preload_path.rb,
lib/serega/plugins/preloads/lib/format_user_preloads.rb,
lib/serega/plugins/preloads/lib/preloads_constructor.rb,
lib/serega/plugins/preloads/validations/check_opt_preload_path.rb
Overview
Plugin adds `.preloads` method to find relations that must be preloaded
Defined Under Namespace
Modules: AttributeMethods, CheckAttributeParamsInstanceMethods, InstanceMethods Classes: CheckOptPreloadPath, EnumDeepFreeze, FormatUserPreloads, MainPreloadPath, PreloadsConstructor
Class Method Summary collapse
- .after_load_plugin(serializer_class, **opts) ⇒ Object
-
.load_plugin(serializer_class, **_opts) ⇒ void
Includes plugin modules to current serializer.
-
.plugin_name ⇒ Symbol
Plugin name.
Class Method Details
.after_load_plugin(serializer_class, **opts) ⇒ Object
35 36 37 38 39 |
# File 'lib/serega/plugins/preloads/preloads.rb', line 35 def self.after_load_plugin(serializer_class, **opts) config = serializer_class.config config[:attribute_keys] += [:preload, :preload_path] config[:preloads] = {auto_preload_relations: opts.fetch(:auto_preload_relations, true)} end |
.load_plugin(serializer_class, **_opts) ⇒ void
This method returns an undefined value.
Includes plugin modules to current serializer
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/serega/plugins/preloads/preloads.rb', line 22 def self.load_plugin(serializer_class, **_opts) serializer_class.include(InstanceMethods) serializer_class::Attribute.include(AttributeMethods) serializer_class::CheckAttributeParams.include(CheckAttributeParamsInstanceMethods) require_relative "./lib/enum_deep_freeze" require_relative "./lib/format_user_preloads" require_relative "./lib/main_preload_path" require_relative "./lib/preloads_constructor" require_relative "./validations/check_opt_preload_path" end |
.plugin_name ⇒ Symbol
Returns plugin name.
10 11 12 |
# File 'lib/serega/plugins/preloads/preloads.rb', line 10 def self.plugin_name :preloads end |