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:



40
41
42
43
44
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 40

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

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.



32
33
34
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 32

def container
  @container
end

#methodObject (readonly)

Returns the value of attribute method.



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

def method
  @method
end

#scopeObject (readonly)

Returns the value of attribute scope.



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

def scope
  @scope
end

Instance Method Details

#callString

Returns:

  • (String)


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

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

#formatted_containerString

Returns:

  • (String)


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

def formatted_container
  container.klass
end

#formatted_methodString

Returns:

  • (String)


70
71
72
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 70

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

#formatted_method_infixString

Returns:

  • (String)

See Also:



79
80
81
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 79

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

#formatted_method_suffixString

Returns:

  • (String)


86
87
88
89
90
91
92
93
94
# File 'lib/convenient_service/core/entities/config/entities/method_middlewares/commands/generate_stack_name.rb', line 86

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

#formatted_scopeString

Returns:

  • (String)


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

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