Sha256: 4a4684d397cf6885cb22738d9eca4dc734c5f3edbc8403e75554e621efd72588

Contents?: true

Size: 632 Bytes

Versions: 2

Compression:

Stored size: 632 Bytes

Contents

module Everything
  class Piece
    class Content
      def initialize(piece_path)
        @piece_path = piece_path
      end

      def file_path
        @file_path ||= File.join(piece_path, file_name)
      end

      def title
        partitioned_text.first.sub('# ', '')
      end

      def body
        partitioned_text.last
      end

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

    private
      attr_reader :piece_path

      def file_name
        'index.md'
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
everything-core-0.0.7 lib/everything/piece/content.rb
everything-core-0.0.6 lib/everything/piece/content.rb