module Blogue

Constants

DEFAULT_ASSETS_PATH
DEFAULT_AUTHOR_NAME
DEFAULT_COMPUTE_POST_CACHE_KEY
DEFAULT_POSTS_PATH
DEFAULT_ROUGE_KRAMDOWN_OPTIONS
VERSION

Attributes

assets_path[RW]
author_name[RW]
cache_key[R]
compute_post_cache_key[RW]
markdown_template_handler[R]
posts_cache_keys[R]
posts_path[RW]
started_at[R]

Public Class Methods

compute_cache_keys!() click to toggle source
# File lib/blogue.rb, line 40
def compute_cache_keys!
  @posts_cache_keys = Hash[Post.all.map { |p|
    [p.id.freeze, Blogue.compute_post_cache_key.(p).freeze]
  }].freeze

  @cache_key = Digest::MD5.hexdigest(
    @posts_cache_keys.values.sort.join
  ).freeze
end
detect_markdown_template_handler() click to toggle source
# File lib/blogue.rb, line 54
def detect_markdown_template_handler
  if defined?(Kramdown) && defined?(Rouge)
    KramdownTemplateHandler.new(DEFAULT_ROUGE_KRAMDOWN_OPTIONS)
  elsif defined?(Kramdown)
    KramdownTemplateHandler.new
  end
end
markdown_template_preprocessor=(preprocessor) click to toggle source
# File lib/blogue.rb, line 50
def markdown_template_preprocessor=(preprocessor)
  self.markdown_template_handler.preprocessor = preprocessor
end
setup_defaults!() click to toggle source
# File lib/blogue.rb, line 30
def setup_defaults!
  self.author_name = DEFAULT_AUTHOR_NAME
  self.posts_path = DEFAULT_POSTS_PATH
  self.assets_path = DEFAULT_ASSETS_PATH
  self.compute_post_cache_key = DEFAULT_COMPUTE_POST_CACHE_KEY

  @markdown_template_handler = detect_markdown_template_handler
  @started_at = Time.current.freeze
end