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

Clarify how the scope parameter works on field methods

This commit is contained in:
Holger Just 2017-02-16 20:53:41 +01:00
parent 057cf2c8f7
commit b9a1b0c386
2 changed files with 9 additions and 7 deletions

View File

@ -107,8 +107,9 @@ module Rackstash
#
# @param array [Array, ::Array, Proc] an array of values. Each value is
# normalized before being added to `self`.
# @param scope [Object] if `array` or any of its (deeply-nested) values is
# a proc, it will be called in the instance scope of this object.
# @param scope [Object, nil] if `array` or any of its (deeply-nested)
# values is a proc, it will be called in the instance scope of this
# object (when given).
# @return [self]
def concat(array, scope: nil)
array = Array(normalize(array, wrap: false, scope: scope))

View File

@ -100,8 +100,9 @@ module Rackstash
# is a proc, it will get called and its result is used instead
# @param force [Boolean] `true` to raise an `ArgumentError` when trying to
# set a forbidden key, `false` to silently ingnore these key-value pairs
# @param scope [Object] if `hash` or any of its (deeply-nested) values is
# a proc, it will be called in the instance scope of this object.
# @param scope [Object, nil] if `hash` or any of its (deeply-nested)
# values is a proc, it will be called in the instance scope of this
# object (when given).
#
# @yield [key, old_val, new-val] if a block is given and there is a
# duplicate key, we call the block and use its return value as the value
@ -139,9 +140,9 @@ module Rackstash
# is a proc, it will get called and its result is used instead
# @param force [Boolean] `true` to raise an `ArgumentError` when trying to
# set a forbidden key, `false` to silently ingnore these key-value pairs
# @param scope [Object] if `hash` or any of its (deeply-nested) values is
# a proc, it will be called in the instance scope of this object.
#
# @param scope [Object, nil] if `hash` or any of its (deeply-nested)
# values is a proc, it will be called in the instance scope of this
# object (when given).
# @yield [key, old_val, new-val] if a block is given and there is a
# duplicate key, we call the block and use its return value as the value
# to insert