Module: ActiveCopy::Source

Included in:
Base
Defined in:
lib/active_copy/source.rb

Instance Method Summary collapse

Instance Method Details

#present?Boolean

Test if the source file is present on this machine.

Returns:

  • (Boolean)


7
8
9
# File 'lib/active_copy/source.rb', line 7

def present?
  File.exists? source_path
end

#raw_sourceObject

Return the raw String source of the Markdown document, including the YAML front matter.



13
14
15
# File 'lib/active_copy/source.rb', line 13

def raw_source
  @raw ||= File.read source_path
end

#sourceObject

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.



20
21
22
# File 'lib/active_copy/source.rb', line 20

def source
  @source ||= raw_source.split("---\n")[2]
end