module Bridgetown::Site::Processable
Public Instance Methods
process()
click to toggle source
Reset, Read, Generate, Render, Cleanup, Process, and Write this Site
to output. @return [void] @see reset
@see read
@see generate @see render @see cleanup @see write
# File lib/bridgetown-core/concerns/site/processable.rb, line 13 def process Bridgetown::Current.site = self reset read generate # Extensible render # Renderable cleanup # Writable write # Writable print_stats if config["profile"] end
read()
click to toggle source
Read data from disk and load it into internal memory. @return [void]
# File lib/bridgetown-core/concerns/site/processable.rb, line 52 def read Bridgetown::Hooks.trigger :site, :pre_read, self reader.read limit_posts! Bridgetown::Hooks.trigger :site, :post_read, self end
reset()
click to toggle source
Reset all in-memory data and content. @return [void]
# File lib/bridgetown-core/concerns/site/processable.rb, line 26 def reset self.time = Time.now if config["time"] self.time = Bridgetown::Utils.parse_date( config["time"].to_s, "Invalid time in bridgetown.config.yml." ) end self.layouts = HashWithDotAccess::Hash.new self.pages = [] self.static_files = [] self.data = HashWithDotAccess::Hash.new @frontend_manifest = nil @post_attr_hash = {} @collections = nil @documents = nil @docs_to_write = nil @regenerator.clear_cache @liquid_renderer.reset frontmatter_defaults.reset Bridgetown::Cache.clear_if_config_changed config Bridgetown::Hooks.trigger :site, :after_reset, self end
Private Instance Methods
limit_posts!()
click to toggle source
Limits the current posts; removes the posts which exceed the limit_posts
# File lib/bridgetown-core/concerns/site/processable.rb, line 62 def limit_posts! if config.limit_posts.positive? Bridgetown::Deprecator.deprecation_message( "The limit_posts config option will be removed prior to Bridgetown 1.0" ) limit = posts.docs.length < config.limit_posts ? posts.docs.length : config.limit_posts posts.docs = posts.docs[-limit, limit] end end
print_stats()
click to toggle source
# File lib/bridgetown-core/concerns/site/processable.rb, line 72 def print_stats Bridgetown.logger.info @liquid_renderer.stats_table end