Class: JekyllLazyLoadImage::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-lazy-load-image/config.rb

Constant Summary collapse

ALLOWED_JEKYLL_HOOK_CONTAINERS =
%i[documents pages posts site].freeze
DEFAULT_CONTAINERS =
%i[posts].freeze

Instance Method Summary collapse

Instance Method Details

#ownersObject



8
9
10
# File 'lib/jekyll-lazy-load-image/config.rb', line 8

def owners
  @owners || DEFAULT_CONTAINERS
end

#owners=(value) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/jekyll-lazy-load-image/config.rb', line 12

def owners=(value)
  return if value.nil? || value.empty?

  @owners = Array(value).map(&:to_sym).tap do |owners_prospective|
    not_allowed_hooks = ALLOWED_JEKYLL_HOOK_CONTAINERS & owners_prospective
    raise ArgumentError, "The owners option must be #{ALLOWED_JEKYLL_HOOK_CONTAINERS.join(" or ")}." if not_allowed_hooks.size.zero?
  end
end