Sha256: c247c0642b704595e9fad3e8eba5824d38b974fbbd7382184929dbcae6cdd711

Contents?: true

Size: 743 Bytes

Versions: 17

Compression:

Stored size: 743 Bytes

Contents

# encoding: utf-8
require 'html/pipeline'
require 'task_list'

class TaskList
  # Provides a summary of provided TaskList `items`.
  #
  # `items` is an Array of TaskList::Item objects.
  class Summary < Struct.new(:items)
    # Public: returns true if there are any TaskList::Item objects.
    def items?
      item_count > 0
    end

    # Public: returns the number of TaskList::Item objects.
    def item_count
      items.size
    end

    # Public: returns the number of complete TaskList::Item objects.
    def complete_count
      items.select{ |i| i.complete? }.size
    end

    # Public: returns the number of incomplete TaskList::Item objects.
    def incomplete_count
      items.select{ |i| !i.complete? }.size
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
deckar01-task_list-2.3.4 lib/task_list/summary.rb
deckar01-task_list-2.3.3 lib/task_list/summary.rb
deckar01-task_list-3.0.alpha2 lib/task_list/summary.rb
deckar01-task_list-3.0.alpha1 lib/task_list/summary.rb
deckar01-task_list-2.3.2 lib/task_list/summary.rb
deckar01-task_list-2.3.1 lib/task_list/summary.rb
deckar01-task_list-2.3.0 lib/task_list/summary.rb
deckar01-task_list-2.2.1 lib/task_list/summary.rb
deckar01-task_list-2.2.0 lib/task_list/summary.rb
deckar01-task_list-2.1.0 lib/task_list/summary.rb
deckar01-task_list-2.0.1 lib/task_list/summary.rb
deckar01-task_list-2.0.0 lib/task_list/summary.rb
deckar01-task_list-1.0.6 lib/task_list/summary.rb
deckar01-task_list-1.0.5 lib/task_list/summary.rb
deckar01-task_list-1.0.4 lib/task_list/summary.rb
deckar01-task_list-1.0.3 lib/task_list/summary.rb
task_list-1.0.2 lib/task_list/summary.rb