Module: Jat::Plugins::BasePreloads::PreloadsWithPath::ClassMethods

Included in:
Jat::Plugins::BasePreloads::PreloadsWithPath
Defined in:
lib/jat/plugins/base/base_preloads/lib/preloads_with_path.rb

Constant Summary collapse

BANG =
"!"
NO_PRELOADS =
[{}.freeze, [].freeze].freeze

Instance Method Summary collapse

Instance Method Details

#call(preloads) ⇒ Object

Parameters:

  • preload (Hash)

    Formatted user provided preloads hash



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/jat/plugins/base/base_preloads/lib/preloads_with_path.rb', line 12

def call(preloads)
  return NO_PRELOADS if preloads.empty?

  path = main_path(preloads)
  return [preloads, path] unless has_bang?(path)

  # We should remove bangs from last key in path and from associated preloads key.
  # We use mutable methods here.
  remove_bangs(preloads, path)
  [preloads, path]
end