Class: ConvenientService::Core::Entities::Config::Entities::Concerns::Entities::Middleware

Inherits:
Object
  • Object
show all
Extended by:
Support::AbstractMethod::ClassMethods
Includes:
Support::Castable
Defined in:
lib/convenient_service/core/entities/config/entities/concerns/entities/middleware.rb,
lib/convenient_service/core/entities/config/entities/concerns/entities/middleware/commands/cast_middleware.rb

Defined Under Namespace

Modules: Commands

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Support::Concern

included

Constructor Details

#initialize(stack) ⇒ void

Parameters:

  • stack (#call<Hash>)


19
20
21
# File 'lib/convenient_service/core/entities/config/entities/concerns/entities/middleware.rb', line 19

def initialize(stack)
  @stack = stack
end

Class Method Details

.==(other) ⇒ Boolean



62
63
64
65
66
67
68
69
# File 'lib/convenient_service/core/entities/config/entities/concerns/entities/middleware.rb', line 62

def ==(other)
  return true if original_two_equals(other)

  return unless other.instance_of?(Class)
  return unless other < Entities::Middleware

  concern == other.concern
end

.cast(other) ⇒ ConvenientService::Core::Entities::Config::Entities::Concerns::Entities::Middleware?



40
41
42
# File 'lib/convenient_service/core/entities/config/entities/concerns/entities/middleware.rb', line 40

def cast(other)
  Commands::CastMiddleware.call(other: other)
end

.concernConvenientService::Support::Concern, Module



34
# File 'lib/convenient_service/core/entities/config/entities/concerns/entities/middleware.rb', line 34

abstract_method :concern

.original_two_equalsBoolean

Returns:

  • (Boolean)


53
# File 'lib/convenient_service/core/entities/config/entities/concerns/entities/middleware.rb', line 53

alias_method :original_two_equals, :==

Instance Method Details

#call(env) ⇒ void

This method returns an undefined value.

Parameters:

  • env (Hash)

Options Hash (env):

  • :klass (Class)


78
79
80
81
82
# File 'lib/convenient_service/core/entities/config/entities/concerns/entities/middleware.rb', line 78

def call(env)
  env[:klass].include concern

  @stack.call(env)
end