class Orchestrate::RefList
An enumerator over a query for listing Ref
values in an Orchestrate::KeyValue
.
Attributes
@return [KeyValue]
Public Class Methods
Public Instance Methods
Accessor for individual Refs. @param ref_id [#to_s] The ref of the specific immutable value to retrieve.
# File lib/orchestrate/refs.rb, line 32 def [](ref_id) response = @key_value.perform(:get, ref_id) Ref.new(@key_value.collection, @key_value.key, response) end
Iterates over each Ref
for the KeyValue
. Used as the basis for Enumerable. Refs are provided in time-series order, newest to oldest. @overload each
@return Enumerator
@overload each(&block)
@yieldparam [Ref] ref the Ref item
@see RefList::Fetcher#each
@example
ref_ids = kv.refs.take(20).map(&:ref)
# File lib/orchestrate/refs.rb, line 50 def each(&block) Fetcher.new(self).each(&block) end
Creates a Lazy Enumerator for the RefList
. If called inside the Applciation’s ‘#in_parallel` block, pre-fetches the first page of results. @return [Enumerator::Lazy]
# File lib/orchestrate/refs.rb, line 57 def lazy Fetcher.new(self).lazy end
Set the offset for the query to Orchestrate
, so you can skip items. Does not fetch results. Implemented as a separate method from drop, unlike take
, because take is a more common use case. @return [RefList::Fetcher]
# File lib/orchestrate/refs.rb, line 73 def offset(count) Fetcher.new(self).offset(count) end
Returns the first n items. Equivalent to Enumerable#take. Sets the ‘limit` parameter on the query to Orchestrate
, so we don’t ask for more items than desired. @return [Array<Ref>]
# File lib/orchestrate/refs.rb, line 65 def take(count) Fetcher.new(self).take(count) end
Specifies that the query to Orchestrate
should use the ‘values` parameter, and that the query should return the values for each ref. @return [RefList::Fetcher]
# File lib/orchestrate/refs.rb, line 80 def with_values Fetcher.new(self).with_values end