Class: Serega::SeregaUtils::PreloadPaths
- Inherits:
-
Object
- Object
- Serega::SeregaUtils::PreloadPaths
- Defined in:
- lib/serega/utils/preload_paths.rb
Overview
Utility that helps to transform preloads to array of paths It is used to validate manually set ‘:preload_path` attribute option has one of allowed values. `:preload_path` option can be used to specify where nested preloads must be attached.
Example:
call({ a: { b: { c: {}, d: {} } }, e: {} })
=> [
[:a],
[:a, :b],
[:a, :b, :c],
[:a, :b, :d],
[:e]
]
Class Method Summary collapse
-
.call(preloads) ⇒ Array
Transforms user provided preloads to array of paths.
Class Method Details
.call(preloads) ⇒ Array
Transforms user provided preloads to array of paths
30 31 32 33 34 35 |
# File 'lib/serega/utils/preload_paths.rb', line 30 def call(preloads) formatted_preloads = FormatUserPreloads.call(preloads) return FROZEN_EMPTY_ARRAY if formatted_preloads.empty? paths(formatted_preloads, [], []) end |