Class: SitePrism::AllThere::RecursionChecker Private

Inherits:
Object
  • Object
show all
Defined in:
lib/site_prism/all_there/recursion_checker.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.

This will recurse through all of the objects found on an individual Page/Section level It will perform the ‘#all_there?` check on each `@instance` item that it is initialized with

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ RecursionChecker

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 a new instance of RecursionChecker.



15
16
17
# File 'lib/site_prism/all_there/recursion_checker.rb', line 15

def initialize(instance)
  @instance = instance
end

Instance Method Details

#all_there?(recursion: nil, options: {}) ⇒ Boolean || Nil

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.

This is only meant to be invoked from the main site_prism gem where it will use whatever inputs it is given

Returns:

  • (Boolean || Nil)


21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/site_prism/all_there/recursion_checker.rb', line 21

def all_there?(recursion: nil, options: {})
  setting = recursion || SitePrism.recursion_setting

  case setting
  when nil, :none
    current_class_all_there?(**options)
  when :one
    current_class_all_there?(**options) && section_classes_all_there?(options) && sections_classes_all_there?(options)
  else
    SitePrism.logger.debug("Invalid input value '#{recursion}'. Valid values are 'nil', ':none' or ':one'.")
    SitePrism.logger.error('Invalid recursion setting, Will not run #all_there?.')
  end
end