Class: ConvenientService::Service::Plugins::CanHaveStepAwareEnumerables::Commands::CastStepAwareEnumerable

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

Constant Summary collapse

RUBY_CLASS_TO_STEP_AWARE_CLASS_MAP =

Returns:

  • (Hash{Class => Class})
{
  ::Array => Entities::StepAwareEnumerables::Array,
  ::Hash => Entities::StepAwareEnumerables::Hash,
  ::Set => Entities::StepAwareEnumerables::Set,
  ::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:



51
52
53
54
55
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerable.rb', line 51

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.



31
32
33
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerable.rb', line 31

def object
  @object
end

#organizerObject (readonly)

Returns the value of attribute organizer.



37
38
39
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerable.rb', line 37

def organizer
  @organizer
end

#propagated_resultObject (readonly)

Returns the value of attribute propagated_result.



43
44
45
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerable.rb', line 43

def propagated_result
  @propagated_result
end

Instance Method Details

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



61
62
63
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerable.rb', line 61

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