Class: PactBroker::UI::ViewDomain::IndexItems

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/ui/view_models/index_items.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index_items, options = {}) ⇒ IndexItems

Returns a new instance of IndexItems.



10
11
12
13
14
15
16
# File 'lib/pact_broker/ui/view_models/index_items.rb', line 10

def initialize index_items, options = {}
  # Why are we sorting twice!?
  @index_items = index_items.collect{ |index_item| IndexItem.new(index_item, options) }.sort
  # until the feature flag is turned on
  @pagination_record_count = index_items.size
  @pagination_record_count = index_items.pagination_record_count if index_items.respond_to?(:pagination_record_count)
end

Instance Attribute Details

#pagination_record_countObject (readonly)

Returns the value of attribute pagination_record_count.



8
9
10
# File 'lib/pact_broker/ui/view_models/index_items.rb', line 8

def pagination_record_count
  @pagination_record_count
end

Instance Method Details

#each(&block) ⇒ Object



18
19
20
# File 'lib/pact_broker/ui/view_models/index_items.rb', line 18

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

#empty?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/pact_broker/ui/view_models/index_items.rb', line 22

def empty?
  index_items.empty?
end

#sizeObject



26
27
28
# File 'lib/pact_broker/ui/view_models/index_items.rb', line 26

def size
  index_items.size
end