Class: Braintrust::ListObjects

Inherits:
Object
  • Object
show all
Defined in:
lib/braintrust/list_objects.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#objectsArray

Returns:

  • (Array)


6
7
8
# File 'lib/braintrust/list_objects.rb', line 6

def objects
  @objects
end

Instance Method Details

#auto_paging_each(&blk) ⇒ nil

Returns:

  • (nil)


30
31
32
33
34
35
36
37
38
39
40
# File 'lib/braintrust/list_objects.rb', line 30

def auto_paging_each(&blk)
  if !blk
    raise "A block must be given to #auto_paging_each"
  end
  page = self
  loop do
    page.objects.each { |e| blk.call(e) }
    break if !page.next_page?
    page = page.next_page
  end
end

#next_pageListObjects

Returns:

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/braintrust/list_objects.rb', line 25

def next_page
  raise NotImplementedError
end

#next_page?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/braintrust/list_objects.rb', line 20

def next_page?
  raise NotImplementedError
end