mirror of
https://github.com/meineerde/rackstash.git
synced 2025-10-17 14:01:01 +00:00
Clarify that all field methods accepting values can also accept Proc
This commit is contained in:
parent
890b193234
commit
b14f7a95af
@ -17,7 +17,7 @@ module Rackstash
|
||||
# concatenating `self` and the given `array` together to produce a
|
||||
# third array.
|
||||
#
|
||||
# @param array [::Array, Rackstash::Fields::Array]
|
||||
# @param array [::Array, Rackstash::Fields::Array, Proc]
|
||||
# @return [Rackstash::Fields::Array]
|
||||
|
||||
# @!method -(array)
|
||||
@ -25,7 +25,7 @@ module Rackstash
|
||||
# copy of `self`, removing any items that also appear in the given
|
||||
# `array`. The order is preserved from `self`.
|
||||
#
|
||||
# @param array [::Array, Rackstash::Fields::Array]
|
||||
# @param array [::Array, Rackstash::Fields::Array, Proc]
|
||||
# @return [Rackstash::Fields::Array]
|
||||
|
||||
# @!method |(array)
|
||||
@ -33,7 +33,7 @@ module Rackstash
|
||||
# with the given `array`, excluding any duplicates and preserving the
|
||||
# order from `self`.
|
||||
#
|
||||
# @param array [::Array, Rackstash::Fields::Array]
|
||||
# @param array [::Array, Rackstash::Fields::Array, Proc]
|
||||
# @return [Rackstash::Fields::Array]
|
||||
|
||||
# @!method &(array)
|
||||
@ -41,7 +41,7 @@ module Rackstash
|
||||
# elements common to `self` and the given `array`, excluding any
|
||||
# duplicates. The order is preserved from `self`.
|
||||
#
|
||||
# @param array [::Array, Rackstash::Fields::Array]
|
||||
# @param array [::Array, Rackstash::Fields::Array, Proc]
|
||||
# @return [Rackstash::Fields::Array]
|
||||
|
||||
%i[+ - | &].each do |op|
|
||||
@ -67,7 +67,7 @@ module Rackstash
|
||||
# You can set nested hashes and arrays here.
|
||||
#
|
||||
# @param index [Integer] the index in the array where we fetch the value
|
||||
# @param value [#call, Object] any value which can be serialized to JSON.
|
||||
# @param value [Object, Proc] any value which can be serialized to JSON.
|
||||
# The value will be normalized before being set so that only JSON-
|
||||
# compatible objects are added into the array.
|
||||
# @return [void]
|
||||
@ -77,7 +77,7 @@ module Rackstash
|
||||
|
||||
# Add a given value at the end of the array
|
||||
#
|
||||
# @param value [#call, Object] any value which can be serialized to JSON.
|
||||
# @param value [Object, Proc] any value which can be serialized to JSON.
|
||||
# The value will be normalized before being added so that only JSON-
|
||||
# compatible objects are added into the array.
|
||||
# @return [self]
|
||||
@ -105,7 +105,7 @@ module Rackstash
|
||||
|
||||
# Appends the elements of `array` to self.
|
||||
#
|
||||
# @param array [Array, ::Array] an array of values. Each value is
|
||||
# @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.
|
||||
|
||||
@ -38,7 +38,7 @@ module Rackstash
|
||||
#
|
||||
# @param key [#to_s] the field name. When setting the field, this name
|
||||
# will be normalized as a frozen UTF-8 string.
|
||||
# @param value [#call, Object] any value which can be serialized to JSON.
|
||||
# @param value [Proc, Object] any value which can be serialized to JSON.
|
||||
# The value will be normalized before being insert so that only JSON-
|
||||
# compatible objects are inserted into the Hash.
|
||||
#
|
||||
@ -199,8 +199,8 @@ module Rackstash
|
||||
# return value as the value to insert at `key`
|
||||
# @yieldparam key [String] The normalized key where the value is being
|
||||
# inserted
|
||||
# @yieldreturn [Object] the intended new value for `key` to be merged into
|
||||
# `self` at `key`.
|
||||
# @yieldreturn [Proc, Object] the intended new value for `key` to be
|
||||
# merged into `self` at `key`.
|
||||
#
|
||||
# @return [Object, nil] The return value of the block or `nil` if no
|
||||
# insertion happened. Note that `nil` is also a valid value to insert
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user