Sha256: 011c92c05c62e750d7a7f7ed0c8e607f8003f15920116a24fc2d05cdeeed9ad3

Contents?: true

Size: 348 Bytes

Versions: 3

Compression:

Stored size: 348 Bytes

Contents

require 'markdo/command'

module Markdo
  class AddCommand < Command
    def run(task)
      File.open(inbox_path, 'a') do |file|
        file.puts(template(task))
      end
    end

    protected

    def template(task)
      "- [ ] #{task}"
    end

    def inbox_path
      File.join(@env['MARKDO_ROOT'], @env['MARKDO_INBOX'])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
markdo-0.1.2 lib/markdo/add_command.rb
markdo-0.1.1 lib/markdo/add_command.rb
markdo-0.1.0 lib/markdo/add_command.rb