Class: ConvenientService::Support::Middleware::StackBuilder
- Inherits:
-
Dependencies::Extractions::RubyMiddleware::Middleware::Builder
- Object
- Dependencies::Extractions::RubyMiddleware::Middleware::Builder
- ConvenientService::Support::Middleware::StackBuilder
- Defined in:
- lib/convenient_service/support/middleware/stack_builder.rb
Instance Method Summary collapse
- #==(other) ⇒ Boolean?
- #dup ⇒ ConvenientService::Support::Middleware::StackBuilder
- #initialize(opts = {}, &block) ⇒ void constructor
- #to_a ⇒ Array
- #unshift(middleware, *args, &block) ⇒ ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack (also: #prepend)
Methods inherited from Dependencies::Extractions::RubyMiddleware::Middleware::Builder
#call, #delete, #flatten, #inject_logger, #insert, #insert_after, #insert_after_each, #insert_before_each, #inspect, #name, #replace, #use
Constructor Details
#initialize(opts = {}, &block) ⇒ void
24 25 26 27 28 29 30 31 |
# File 'lib/convenient_service/support/middleware/stack_builder.rb', line 24 def initialize(opts = {}, &block) super ## # https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L174 # self.stack = opts[:stack] if opts.has_key?(:stack) end |
Instance Method Details
#==(other) ⇒ Boolean?
68 69 70 71 72 73 74 75 |
# File 'lib/convenient_service/support/middleware/stack_builder.rb', line 68 def ==(other) return unless other.instance_of?(self.class) return false if name != other.name return false if stack != other.stack true end |
#dup ⇒ ConvenientService::Support::Middleware::StackBuilder
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/convenient_service/support/middleware/stack_builder.rb', line 96 def dup self.class.new( ## # https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L45 # runner_class: @runner_class, ## # https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L46 # name: @middleware_name.dup, ## # https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L167 # stack: stack.dup ) end |
#to_a ⇒ Array
86 87 88 |
# File 'lib/convenient_service/support/middleware/stack_builder.rb', line 86 def to_a stack end |
#unshift(middleware, *args, &block) ⇒ ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack Also known as: prepend
42 43 44 45 46 |
# File 'lib/convenient_service/support/middleware/stack_builder.rb', line 42 def unshift(middleware, *args, &block) stack.unshift([middleware, args, block]) self end |