Sha256: 9ce395a59b46b2090d2beb9aebd1adb9f9666bb0241943003fe4d09e927cebf9

Contents?: true

Size: 534 Bytes

Versions: 1

Compression:

Stored size: 534 Bytes

Contents

module Everything
  class Piece
    def initialize(full_path)
      @full_path = full_path
    end

    def title
      @title ||= partitioned_content.first.sub('# ', '')
    end

    def content
      @content ||= partitioned_content.last
    end

    def raw_markdown
      @raw_markdown ||= File.read(content_path)
    end

  private
    def content_path
      @content_path ||= File.join(@full_path, 'index.md')
    end

    def partitioned_content
      @partitioned_content ||= raw_markdown.partition("\n\n")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
everything-core-0.0.3 lib/everything/piece.rb