Class: ConvenientService::Service::Plugins::CanHaveStepAwareEnumerables::Commands::CastStepAwareEnumerator

Inherits:
ConvenientService::Support::Command show all
Defined in:
lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerator.rb

Constant Summary collapse

RUBY_CLASS_TO_STEP_AWARE_CLASS_MAP =

Returns:

  • (Hash{Class => Class})
{
  ::Enumerator => Entities::StepAwareEnumerables::Enumerator,
  ::Enumerator::Lazy => Entities::StepAwareEnumerables::LazyEnumerator,
  ::Enumerator::Chain => Entities::StepAwareEnumerables::ChainEnumerator,
  ::Enumerator::ArithmeticSequence => Entities::StepAwareEnumerables::ArithmeticSequenceEnumerator
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ConvenientService::Support::Command

[], call

Constructor Details

#initialize(object:, organizer:, propagated_result: nil) ⇒ void

Parameters:



48
49
50
51
52
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerator.rb', line 48

def initialize(object:, organizer:, propagated_result: nil)
  @object = object
  @organizer = organizer
  @propagated_result = propagated_result
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



28
29
30
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerator.rb', line 28

def object
  @object
end

#organizerObject (readonly)

Returns the value of attribute organizer.



34
35
36
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerator.rb', line 34

def organizer
  @organizer
end

#propagated_resultObject (readonly)

Returns the value of attribute propagated_result.



40
41
42
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerator.rb', line 40

def propagated_result
  @propagated_result
end

Instance Method Details

#callConvenientService::Service::Plugins::CanHaveStepAwareEnumerables::Entities::StepAwareEnumerables::Enumerable



58
59
60
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerator.rb', line 58

def call
  step_aware_enumerable_klass&.new(**attributes) || ::ConvenientService.raise(Exceptions::ObjectIsNotEnumerator.new(object: object))
end