Sha256: 44786119da10fd03cb9d984c51500da4105b65d9186eb85a92948ee5899983ff

Contents?: true

Size: 724 Bytes

Versions: 6

Compression:

Stored size: 724 Bytes

Contents

# frozen_string_literal: true

module FrontMatterParser
  # Result of parsing front matter and content from a string
  class Parsed
    # @!attribute [rw] front_matter
    # @see #initialize
    attr_reader :front_matter

    # @!attribute [rw] content
    # @see #initialize
    attr_reader :content

    # @param front_matter [Hash] parsed front_matter
    # @param content [String] parsed content
    def initialize(front_matter:, content:)
      @front_matter = front_matter
      @content = content
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
front_matter_parser-1.0.1 lib/front_matter_parser/parsed.rb
front_matter_parser-1.0.0 lib/front_matter_parser/parsed.rb
front_matter_parser-0.2.1 lib/front_matter_parser/parsed.rb
front_matter_parser-0.2.0 lib/front_matter_parser/parsed.rb
front_matter_parser-0.1.1 lib/front_matter_parser/parsed.rb
front_matter_parser-0.1.0 lib/front_matter_parser/parsed.rb