Class: ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Commands::GenerateStackName

Inherits:
Support::Command
  • Object
show all
Defined in:
lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(scope:, method:, container:) ⇒ void

Parameters:



35
36
37
38
39
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 35

def initialize(scope:, method:, container:)
  @method = method
  @scope = scope
  @container = container
end

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.



27
28
29
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 27

def container
  @container
end

#methodObject (readonly)

Returns the value of attribute method.



21
22
23
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 21

def method
  @method
end

#scopeObject (readonly)

Returns the value of attribute scope.



15
16
17
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 15

def scope
  @scope
end

Instance Method Details

#callString

Returns:

  • (String)


44
45
46
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 44

def call
  "#{formatted_container}::MethodMiddlewares::#{formatted_scope}::#{formatted_method}"
end

#formatted_containerString

Returns:

  • (String)


51
52
53
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 51

def formatted_container
  container.klass
end

#formatted_methodString

Returns:

  • (String)


65
66
67
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 65

def formatted_method
  "#{formatted_method_infix}#{formatted_method_suffix}"
end

#formatted_method_infixString

Returns:

  • (String)

See Also:



74
75
76
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 74

def formatted_method_infix
  Utils::String.camelize(method)
end

#formatted_method_suffixString

Returns:

  • (String)


81
82
83
84
85
86
87
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 81

def formatted_method_suffix
  if method.end_with?("?")
    "QuestionMark"
  elsif method.end_with?("!")
    "ExclamationMark"
  end
end

#formatted_scopeString

Returns:

  • (String)


58
59
60
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 58

def formatted_scope
  Utils::String.camelize(scope)
end