Class: Prato::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/prato/table.rb

Instance Method Summary collapse

Constructor Details

#initialize(spec) ⇒ Table

Returns a new instance of Table.



5
6
7
# File 'lib/prato/table.rb', line 5

def initialize(spec)
  @spec = spec
end

Instance Method Details

#batches(scope, params = nil, batch_size: 1000, &block) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/prato/table.rb', line 27

def batches(scope, params = nil, batch_size: 1000, &block)
  return enum_for(:batches, scope, params, batch_size: batch_size) unless block

  Internal::QueryExecutor.execute_in_batches(
    scope,
    @spec,
    raw_params: params,
    batch_size: batch_size,
    &block
  )
end

#full(scope, params = nil) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/prato/table.rb', line 18

def full(scope, params = nil)
  Internal::QueryExecutor.execute(
    scope,
    @spec,
    raw_params: params,
    paginated: false
  )
end

#page(scope, params = nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/prato/table.rb', line 9

def page(scope, params = nil)
  Internal::QueryExecutor.execute(
    scope,
    @spec,
    raw_params: params,
    paginated: true
  )
end