Sha256: 68c7d50a98774d6db047c4d202fc75910cf071c238df9005043f9a028a6a4e16

Contents?: true

Size: 533 Bytes

Versions: 2

Compression:

Stored size: 533 Bytes

Contents

class 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

2 entries across 2 versions & 1 rubygems

Version Path
everything-core-0.0.2 lib/everything/piece.rb
everything-core-0.0.1 lib/everything/piece.rb