class Confinement::Content

Attributes

layout[RW]
locals[RW]

Public Class Methods

new(input_path:, layout: nil, locals: {}, renderers: :guess) click to toggle source
# File lib/confinement.rb, line 445
def initialize(input_path:, layout: nil, locals: {}, renderers: :guess)
  self.input_path = input_path

  self.layout = layout
  self.locals = locals
  self.renderers = renderers
end

Public Instance Methods

body() click to toggle source
# File lib/confinement.rb, line 456
def body
  parse_body_and_frontmatter
  @body
end
frontmatter() click to toggle source
# File lib/confinement.rb, line 461
def frontmatter
  parse_body_and_frontmatter
  @frontmatter
end

Private Instance Methods

parse_body_and_frontmatter() click to toggle source
# File lib/confinement.rb, line 468
def parse_body_and_frontmatter
  return if defined?(@frontmatter) && defined?(@body)
  @frontmatter, @body = input_path.read.frontmatter_and_body
end