Class: ConvenientService::Service::Plugins::CanHaveStepAwareEnumerables::Entities::StepAwareEnumerables::Enumerator

Inherits:
Enumerable
  • Object
show all
Defined in:
lib/convenient_service/service/plugins/can_have_step_aware_enumerables/entities/step_aware_enumerables/enumerator.rb

Instance Attribute Summary

Attributes inherited from Base

#modifiers, #object, #organizer, #propagated_result

Instance Method Summary collapse

Methods inherited from Enumerable

#all?, #any?, #chain, #chunk, #chunk_while, #collect, #collect_concat, #compact, #count, #cycle, #detect, #drop, #drop_while, #each, #each_cons, #each_entry, #each_slice, #each_with_index, #each_with_object, #entries, #filter, #filter_map, #find, #find_all, #find_index, #first, #flat_map, #grep, #grep_v, #group_by, #include?, #inject, #lazy, #map, #max, #max_by, #member?, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reduce, #reject, #reverse_each, #select, #select_exactly, #slice_after, #slice_before, #slice_when, #sort, #sort_by, #sum, #take, #take_while, #tally, #to_a, #to_h, #to_set, #uniq, #zip

Methods inherited from Base

#evaluate_by, #initialize, #result

Methods included from ConvenientService::Support::AbstractMethod

abstract_method

Instance Method Details

#default_data_keySymbol

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Symbol)


34
35
36
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/entities/step_aware_enumerables/enumerator.rb', line 34

def default_data_key
  :values
end

#default_evaluate_bySymbol

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Symbol)


43
44
45
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/entities/step_aware_enumerables/enumerator.rb', line 43

def default_evaluate_by
  :to_a
end

#with_index(offset = nil, &iteration_block) ⇒ ConvenientService::Service::Plugins::CanHaveStepAwareEnumerables::Entities::StepAwareEnumerables::Enumerable, ConvenientService::Service::Plugins::CanHaveStepAwareEnumerables::Entities::StepAwareEnumerables::Enumerator



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/entities/step_aware_enumerables/enumerator.rb', line 54

def with_index(offset = nil, &iteration_block)
  if iteration_block
    with_processing_return_value_as_enumerable(arguments(offset, &iteration_block), allow_modifier: true) do |offset, &step_aware_iteration_block|
      enumerator.with_index(offset, &step_aware_iteration_block)
    end
  else
    with_processing_return_value_as_enumerator(arguments(offset)) do |offset|
      enumerator.with_index(offset)
    end
  end
end

#with_object(obj, &iteration_block) ⇒ ConvenientService::Service::Plugins::CanHaveStepAwareEnumerables::Entities::StepAwareEnumerables::Enumerable, ConvenientService::Service::Plugins::CanHaveStepAwareEnumerables::Entities::StepAwareEnumerables::Enumerator



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/entities/step_aware_enumerables/enumerator.rb', line 73

def with_object(obj, &iteration_block)
  if iteration_block
    with_processing_return_value_as_object(arguments(obj, &iteration_block), allow_modifier: true) do |obj, &step_aware_iteration_block|
      enumerator.with_object(obj, &step_aware_iteration_block)
    end
  else
    with_processing_return_value_as_enumerator(arguments(obj)) do |obj|
      enumerator.with_object(obj)
    end
  end
end