Class: ConvenientService::Support::Middleware::StackBuilder::Entities::Builders::RubyMiddleware
Instance Method Summary
collapse
#call, #delete, #flatten, #inject_logger, #insert, #insert_after, #insert_after_each, #insert_before_each, #inspect, #name, #replace, #use
Constructor Details
#initialize(opts = {}, &block) ⇒ void
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/convenient_service/support/middleware/stack_builder/entities/builders/ruby_middleware.rb', line 25
def initialize(opts = {}, &block)
super
@middleware_name = opts.fetch(:name) { "Stack" }
self.stack = opts[:stack] if opts.has_key?(:stack)
end
|
Instance Method Details
#==(other) ⇒ Boolean?
95
96
97
98
99
100
101
102
|
# File 'lib/convenient_service/support/middleware/stack_builder/entities/builders/ruby_middleware.rb', line 95
def ==(other)
return unless other.instance_of?(self.class)
return false if name != other.name
return false if stack != other.stack
true
end
|
#clear ⇒ Boolean
54
55
56
57
58
|
# File 'lib/convenient_service/support/middleware/stack_builder/entities/builders/ruby_middleware.rb', line 54
def clear
stack.clear
self
end
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# File 'lib/convenient_service/support/middleware/stack_builder/entities/builders/ruby_middleware.rb', line 123
def dup
self.class.new(
runner_class: @runner_class,
name: @middleware_name.dup,
stack: stack.dup
)
end
|
#empty? ⇒ Boolean
39
40
41
|
# File 'lib/convenient_service/support/middleware/stack_builder/entities/builders/ruby_middleware.rb', line 39
def empty?
stack.empty?
end
|
#has?(some_middleware) ⇒ Boolean
47
48
49
|
# File 'lib/convenient_service/support/middleware/stack_builder/entities/builders/ruby_middleware.rb', line 47
def has?(some_middleware)
stack.any? { |middleware| middleware == [some_middleware, [], nil] }
end
|
#to_a ⇒ Array
113
114
115
|
# File 'lib/convenient_service/support/middleware/stack_builder/entities/builders/ruby_middleware.rb', line 113
def to_a
stack.map(&:first)
end
|
69
70
71
72
73
|
# File 'lib/convenient_service/support/middleware/stack_builder/entities/builders/ruby_middleware.rb', line 69
def unshift(middleware, *args, &block)
stack.unshift([middleware, args, block])
self
end
|