Class: Msgtrail::MarkdownFile

Inherits:
Object
  • Object
show all
Defined in:
lib/msgtrail/markdown_file.rb

Class Method Summary collapse

Class Method Details

.file_bodies(working_directory, article) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/msgtrail/markdown_file.rb', line 4

def self.file_bodies(working_directory, article)
  filepath = File.join(working_directory, article[:file])
  begin
    body = File.read(filepath)
  rescue
    puts("Can't find file '#{filepath}' (#{$!})")
    exit(2)
  end
  [
    {
      body: body,
      source: nil,
      type: Article::TYPE_FILE
    }
  ]
end