class Markdo::DataSource

Public Class Methods

new(env) click to toggle source
# File lib/markdo/data_source.rb, line 3
def initialize(env)
  @env = env
end

Public Instance Methods

file_path(filename) click to toggle source
# File lib/markdo/data_source.rb, line 23
def file_path(filename)
  File.join(@env['MARKDO_ROOT'], filename)
end
inbox_path() click to toggle source
# File lib/markdo/data_source.rb, line 19
def inbox_path
  file_path(@env['MARKDO_INBOX'])
end
lines_from_all() click to toggle source
# File lib/markdo/data_source.rb, line 7
def lines_from_all
  Dir.
    glob("#{@env['MARKDO_ROOT']}/*.md").
    sort.
    map { |path| File.readlines(path, encoding: 'UTF-8') }.
    flatten
end
lines_from_inbox() click to toggle source
# File lib/markdo/data_source.rb, line 15
def lines_from_inbox
  File.readlines(inbox_path, encoding: 'UTF-8')
end