Module: Jbr::Listable
Overview
What a list of records answers, and how much of an account it costs to ask. Jobber prices a query by the page it asks for and by what every row of that page carries, so a list is read either as records or as the IDs alone, each with a page sized to what it carries.
Constant Summary collapse
- PAGE =
Records a page, not forty and not a hundred: what an includes brings back is charged for on top of every row of it, so a page of jobs carrying their lines, their property and its client priced past what a bucket holds. Half the page costs half the query and loses nothing, since a walk simply reads more pages.
20- IDS_PAGE =
IDs a page, which the same budget affords five times over where a row carries one field and no nesting at all.
100
Instance Method Summary collapse
-
#each ⇒ Object
Every record the list is narrowed to, oldest first.
-
#ids ⇒ Array<String>
The ID Jobber files each record under, and nothing else about it: the cheapest question an account can be walked with, and the one to ask where every record is then read on its own through #find.
-
#past ⇒ Listable
The same list, narrowed to what started before now.
-
#upcoming ⇒ Listable
The same list, narrowed to what is scheduled from now on.
Instance Method Details
#each ⇒ Object
Every record the list is narrowed to, oldest first. Nothing is read until the walk starts, and a page is read only once the one before it runs out.
20 |
# File 'lib/jbr/listable.rb', line 20 def each(&) = walk(page).each(&) |
#ids ⇒ Array<String>
The ID Jobber files each record under, and nothing else about it: the cheapest question an account can be walked with, and the one to ask where every record is then read on its own through #find.
32 |
# File 'lib/jbr/listable.rb', line 32 def ids = walk(ids_page).map(&:id) |
#past ⇒ Listable
Returns the same list, narrowed to what started before now.
26 |
# File 'lib/jbr/listable.rb', line 26 def past = narrowed until_now |
#upcoming ⇒ Listable
Returns the same list, narrowed to what is scheduled from now on.
23 |
# File 'lib/jbr/listable.rb', line 23 def upcoming = narrowed from_now |