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

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:



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

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.



18
19
20
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerable.rb', line 18

def object
  @object
end

#organizerObject (readonly)

Returns the value of attribute organizer.



24
25
26
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/commands/cast_step_aware_enumerable.rb', line 24

def organizer
  @organizer
end

#propagated_resultObject (readonly)

Returns the value of attribute propagated_result.



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

def propagated_result
  @propagated_result
end

Instance Method Details

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

Returns:

Raises:

  • (ConvenientService::Service::Plugins::CanHaveStepAwareEnumerables::Exceptions::CollectionIsNotEnumerable)


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

def call
  raise ::ConvenientService.raise Exceptions::ObjectIsNotEnumerable.new(object: object) unless object.is_a?(::Enumerable)

  Entities::StepAwareEnumerables::Enumerable.new(object: object, organizer: organizer, propagated_result: propagated_result)
end