Sha256: 5f34051c1effc88d1fdd5c88fcc5ef49aaa377a7ec8576a358b45da17e4b9576

Contents?: true

Size: 749 Bytes

Versions: 4

Compression:

Stored size: 749 Bytes

Contents

# Parsed is the result of calling {FrontMatterParser.parse} or {FrontMatterParser.parse_file} in {FrontMatterParser}. It keeps the front matter and the content parsed and it has some useful methods to work with them.
class FrontMatterParser::Parsed
  # @!attribute [rw] front_matter
  #   @return [Hash{String => String, Array, Hash}] the parsed front matter
  # @!attribute [rw] content
  #   @return [String] the parsed content
  attr_accessor :front_matter, :content

  alias_method :to_hash, :front_matter

  # Returns the front matter value for the given key
  #
  # @param key [String] The key of the front matter
  # @return [String, Array, Hash] The value of the front matter for the given key
  def [](key)
    @front_matter[key]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
front_matter_parser-0.0.4 lib/front_matter_parser/parsed.rb
front_matter_parser-0.0.3 lib/front_matter_parser/parsed.rb
front_matter_parser-0.0.2 lib/front_matter_parser/parsed.rb
front_matter_parser-0.0.1 lib/front_matter_parser/parsed.rb