Class: ConvenientService::Core::Entities::Config::Entities::Concerns
- Inherits:
-
Object
- Object
- ConvenientService::Core::Entities::Config::Entities::Concerns
- Defined in:
- lib/convenient_service/core/entities/config/entities/concerns.rb,
lib/convenient_service/core/entities/config/entities/concerns/entities/stack.rb,
lib/convenient_service/core/entities/config/entities/concerns/entities/middleware.rb,
lib/convenient_service/core/entities/config/entities/concerns/entities/default_concern.rb,
lib/convenient_service/core/entities/config/entities/concerns/entities/middleware/commands/cast_middleware.rb
Defined Under Namespace
Modules: Entities
Instance Method Summary collapse
- #==(other) ⇒ Boolean?
- #class_method_defined?(method_name) ⇒ Boolean
- #configure(&configuration_block) ⇒ ConvenientService::Core::Entities::Config::Entities::Concerns
-
#include! ⇒ Boolean
Includes concerns into klass when called for the first time.
-
#included? ⇒ Boolean
Checks whether concerns are included into klass (include! was called at least once).
- #initialize(klass:) ⇒ void constructor
- #instance_method_defined?(method_name) ⇒ Boolean
- #private_class_method_defined?(method_name) ⇒ Boolean
- #private_instance_method_defined?(method_name) ⇒ Boolean
-
#to_a ⇒ Array<Module>
Concerns as plain modules.
Constructor Details
#initialize(klass:) ⇒ void
15 16 17 |
# File 'lib/convenient_service/core/entities/config/entities/concerns.rb', line 15 def initialize(klass:) @klass = klass end |
Instance Method Details
#==(other) ⇒ Boolean?
103 104 105 106 107 108 109 110 |
# File 'lib/convenient_service/core/entities/config/entities/concerns.rb', line 103 def ==(other) return unless other.instance_of?(self.class) return false if klass != other.klass return false if stack != other.stack true end |
#class_method_defined?(method_name) ⇒ Boolean
45 46 47 |
# File 'lib/convenient_service/core/entities/config/entities/concerns.rb', line 45 def class_method_defined?(method_name) class_method_defined_in_class_methods_modules?(method_name) end |
#configure(&configuration_block) ⇒ ConvenientService::Core::Entities::Config::Entities::Concerns
73 74 75 76 77 |
# File 'lib/convenient_service/core/entities/config/entities/concerns.rb', line 73 def configure(&configuration_block) Utils::Proc.exec_config(configuration_block, stack) self end |
#include! ⇒ Boolean
Includes concerns into klass when called for the first time. Does nothing for the subsequent calls.
91 92 93 94 95 96 97 |
# File 'lib/convenient_service/core/entities/config/entities/concerns.rb', line 91 def include! return false if included? stack.dup.insert_before(0, Entities::DefaultConcern).call(klass: klass) true end |
#included? ⇒ Boolean
Checks whether concerns are included into klass (include! was called at least once).
65 66 67 |
# File 'lib/convenient_service/core/entities/config/entities/concerns.rb', line 65 def included? klass.include?(Entities::DefaultConcern) end |
#instance_method_defined?(method_name) ⇒ Boolean
23 24 25 26 27 28 |
# File 'lib/convenient_service/core/entities/config/entities/concerns.rb', line 23 def instance_method_defined?(method_name) return true if instance_method_defined_in_instance_methods_modules?(method_name) return true if instance_method_defined_directly?(method_name) false end |
#private_class_method_defined?(method_name) ⇒ Boolean
53 54 55 |
# File 'lib/convenient_service/core/entities/config/entities/concerns.rb', line 53 def private_class_method_defined?(method_name) private_class_method_defined_in_class_methods_modules?(method_name) end |
#private_instance_method_defined?(method_name) ⇒ Boolean
34 35 36 37 38 39 |
# File 'lib/convenient_service/core/entities/config/entities/concerns.rb', line 34 def private_instance_method_defined?(method_name) return true if private_instance_method_defined_in_instance_methods_modules?(method_name) return true if private_instance_method_defined_directly?(method_name) false end |
#to_a ⇒ Array<Module>
Returns concerns as plain modules.
115 116 117 |
# File 'lib/convenient_service/core/entities/config/entities/concerns.rb', line 115 def to_a plain_concerns end |