Sha256: 2985eab43cff5d64a0ae23ad064cc80c172b1ac4e6a1124e7d9d8573ad58e9da

Contents?: true

Size: 498 Bytes

Versions: 3

Compression:

Stored size: 498 Bytes

Contents

module Nin
  module Presenter
    class TodoPresenter < ::SimpleDelegator
      def call
        return 'No todo items yet. Call `nin add hello world` to add a new item.' if self.empty?

        formatting_options = { separating_spaces: 4,
                               longest_id: self.map(&:id).max.length,
                               longest_date: 11 }

        self.map do |item|
          Presenter::ItemPresenter.new(item).call(formatting_options)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nin-1.3.0 lib/nin/presenters/todo_presenter.rb
nin-1.2.0 lib/nin/presenters/todo_presenter.rb
nin-1.0.1 lib/nin/presenters/todo_presenter.rb