Class: Bridgetown::FrontMatter::Loaders::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bridgetown-core/front_matter/loaders/base.rb

Overview

An abstract base class for processing front matter

Direct Known Subclasses

Ruby, YAML

Instance Method Summary collapse

Constructor Details

#initialize(origin_or_layout) ⇒ Base

Returns a new instance of Base.

Parameters:



9
10
11
# File 'lib/bridgetown-core/front_matter/loaders/base.rb', line 9

def initialize(origin_or_layout)
  @origin_or_layout = origin_or_layout
end

Instance Method Details

#read(file_contents, file_path:) ⇒ Result?

Reads the contents of a file, returning a possible Result

Parameters:

  • file_contents (String)

    the contents of the file being processed

  • file_path (String)

    the path to the file being processed

Returns:



18
19
20
# File 'lib/bridgetown-core/front_matter/loaders/base.rb', line 18

def read(file_contents, file_path:) # rubocop:disable Lint/UnusedMethodArgument
  raise "Implement #read in a subclass of Bridgetown::FrontMatter::Loaders::Base"
end