Class: ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Commands::CastMethodDirection

Inherits:
ConvenientService::Support::Command show all
Defined in:
lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_direction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ConvenientService::Support::Command

[], call

Constructor Details

#initialize(other:, options:) ⇒ CastMethodDirection

Returns a new instance of CastMethodDirection.

Parameters:

  • other (Object)

    Can be any type.

  • options (Hash)


31
32
33
34
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_direction.rb', line 31

def initialize(other:, options:)
  @other = other
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



19
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_direction.rb', line 19

attr_reader :other

#otherObject (readonly)

Returns the value of attribute other.



19
20
21
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_direction.rb', line 19

def other
  @other
end

Instance Method Details

#callEntities::Directions::Base?

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_direction.rb', line 39

def call
  casted =
    case options[:direction]
    when ::Symbol then cast_symbol
    when ::String then cast_string
    end

  ##
  # TODO: Specs. Priority.
  #
  return casted if casted

  case other
  when Method then cast_method
  end
end