Sha256: 5e4a88a5bd14daa9a77ccd334a0ceaac2800666822272547b6b638d2266fc483

Contents?: true

Size: 644 Bytes

Versions: 13

Compression:

Stored size: 644 Bytes

Contents

require 'pact_broker/ui/view_models/index_item'

module PactBroker
  module UI
    module ViewDomain
      class IndexItems

        def initialize index_items
          @index_items = index_items.collect{ |index_item| IndexItem.new(index_item) }.sort
        end

        def each(&block)
          index_items.each(&block)
        end

        def size_label
          case index_items.size
          when 1 then "1 pact"
          else
            "#{index_items.size} pacts"
          end
        end

        def empty?
          index_items.empty?
        end

        private

        attr_reader :index_items
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pact_broker-2.40.0 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.39.0 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.38.1 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.38.0 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.37.0 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.36.1 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.36.0 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.35.0 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.34.0 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.33.0 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.32.0 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.31.0 lib/pact_broker/ui/view_models/index_items.rb
pact_broker-2.30.0 lib/pact_broker/ui/view_models/index_items.rb