1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-10-17 14:01:01 +00:00

Don't mix hash arguments with keyword arguments

Since Ruby 2.7 differences explicit keyword arguments from implicit hash
arguments, we should also avoid mixing them. By using explicit keyword
arguments, we avoid warning in Ruby 2.7 and errors in Ruby 3.0.
This commit is contained in:
Holger Just 2019-10-07 19:41:59 +02:00
parent a9641e907d
commit 9e92e706bf
2 changed files with 6 additions and 6 deletions

View File

@ -43,8 +43,8 @@ module Rackstash
# @param buffer_args [Hash<Symbol => Object>] optional arguments for the new
# {Buffer}. See {Buffer#initialize} for allowed values.
# @return [Buffer] the newly created buffer
def push(buffer_args = {})
buffer = Buffer.new(@flows, buffer_args)
def push(**buffer_args)
buffer = Buffer.new(@flows, **buffer_args)
@stack.push buffer
buffer

View File

@ -401,8 +401,8 @@ module Rackstash
# @param buffer_args [Hash<Symbol => Object>] optional arguments for the new
# {Buffer}. See {Buffer#initialize} for allowed values.
# @return [Buffer] the newly pushed {Buffer} instance
def push_buffer(buffer_args = {})
buffer_stack.push(buffer_args)
def push_buffer(**buffer_args)
buffer_stack.push(**buffer_args)
end
# Remove a previously pushed {Buffer} from the {BufferStack} for the current
@ -451,10 +451,10 @@ module Rackstash
# removed from the {BufferStack} again and is always flushed
# automatically.
# @return [Object] the return value of the block
def capture(buffer_args = {})
def capture(**buffer_args)
raise ArgumentError, 'block required' unless block_given?
buffer_stack.push(buffer_args)
buffer_stack.push(**buffer_args)
begin
yield
ensure