Sha256: e4a04c7c812d6d69ce43d96b2b682f2dff4d5acb1bdf46af302005e477c46f8c

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

# Methods for extracting the source of the Markdown document.

module ActiveCopy
  module Source
    # Test if the source file is present on this machine.
    def present?
      File.exists? source_path
    end

    # Return the raw String source of the Markdown document, including
    # the YAML front matter.
    def raw_source
      @raw ||= File.read source_path
    end

    # Return the String source of the Markdown document without the YAML
    # front matter. This is what is passed into ActionView to render the
    # Markdown from this file.
    def source
      @source ||= raw_source.split("---\n")[2]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_copy-1.0.0 lib/active_copy/source.rb
active_copy-1.0.0.pre lib/active_copy/source.rb