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)


36
37
38
39
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_direction.rb', line 36

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

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



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

attr_reader :other

#otherObject (readonly)

Returns the value of attribute other.



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

def other
  @other
end

Instance Method Details

#callEntities::Directions::Base?

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_direction.rb', line 44

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