-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core): reorganize feature envy classes
- Loading branch information
Showing
18 changed files
with
797 additions
and
536 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...ient_service/core/entities/config/entities/method_middlewares/entities/caller/commands.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "commands/cast_caller" | ||
require_relative "commands/define_method_middlewares_caller" |
72 changes: 72 additions & 0 deletions
72
.../core/entities/config/entities/method_middlewares/entities/caller/commands/cast_caller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# frozen_string_literal: true | ||
|
||
module ConvenientService | ||
module Core | ||
module Entities | ||
class Config | ||
module Entities | ||
class MethodMiddlewares | ||
module Entities | ||
class Caller | ||
module Commands | ||
class CastCaller < Support::Command | ||
## | ||
# @!attribute [r] other | ||
# @return [Hash] | ||
# | ||
attr_reader :other | ||
|
||
## | ||
# @param other [Hash, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Caller] | ||
# @return [void] | ||
# | ||
def initialize(other:) | ||
@other = other | ||
end | ||
|
||
## | ||
# @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Caller, nil] | ||
# | ||
def call | ||
case other | ||
when ::Hash | ||
cast_hash(other) | ||
when Caller | ||
cast_caller(other) | ||
end | ||
end | ||
|
||
private | ||
|
||
## | ||
# @param hash [Hash] | ||
# @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Caller, nil] | ||
# | ||
def cast_hash(hash) | ||
return unless hash[:scope] | ||
|
||
case hash[:scope] | ||
when :instance | ||
Caller.new(prefix: Caller::INSTANCE_PREFIX) | ||
when :class | ||
Caller.new(prefix: Caller::CLASS_PREFIX) | ||
end | ||
end | ||
|
||
## | ||
# @param caller [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Caller] | ||
# @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Caller] | ||
# | ||
def cast_caller(caller) | ||
caller.copy | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...nient_service/core/entities/config/entities/method_middlewares/entities/caller/concern.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "concern/instance_methods" | ||
require_relative "concern/class_methods" | ||
|
||
module ConvenientService | ||
module Core | ||
module Entities | ||
class Config | ||
module Entities | ||
class MethodMiddlewares | ||
module Entities | ||
class Caller | ||
module Concern | ||
include Support::Concern | ||
|
||
included do |container_klass| | ||
container_klass.include Support::Castable | ||
|
||
container_klass.include InstanceMethods | ||
|
||
container_klass.extend ClassMethods | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.