Sha256: 7362f05fd50c45882b94407aab1d03ccd4032a77b11f2444678c7e11666c7abd

Contents?: true

Size: 662 Bytes

Versions: 1

Compression:

Stored size: 662 Bytes

Contents

# frozen_string_literal: true

module TooDoo
  module Commands
    # list your tasks
    # usage: td list
    class Simple < Base
      def run!
        perform!
      end

      def perform!
        tasks = find_tasks
        @message = build_message(tasks)
        puts @message
      end

      private

      def find_tasks
        raise NotImplementedError
      end

      def empty_list_message
        raise NotImplementedError
      end

      def build_message(tasks)
        return empty_list_message if tasks.empty?

        tasks.inject('') do |put, task|
          put + " - #{task.body}\n" unless task.nil?
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
toodoo-0.1.1 lib/toodoo/commands/simple.rb