diff --git a/lib/rackstash/filters/replace.rb b/lib/rackstash/filters/replace.rb index f574cba..40ec694 100644 --- a/lib/rackstash/filters/replace.rb +++ b/lib/rackstash/filters/replace.rb @@ -8,10 +8,13 @@ module Rackstash module Filters # Replace fields in the given event with new values. A new value can be - # specified as either a fixed value or as a Proc (or any other object + # specified as either a fixed value or as a `Proc` (or any other object # responding to `call`). In the latter case, the callable object will be - # called with the event as its argument. It is then expectd to return the - # new value which is set on the key + # called with the event as its argument. It is then expected to return the + # new value which is set on the key. + # + # If a specified field does not exist in the event hash, it will be created + # with the given (or calculated) value anyway. # # @example # Rackstash::Flow.new(STDOUT) do @@ -20,8 +23,9 @@ module Rackstash # } # end # - # You should make sure to only set a new object of the basic types here, - # namely `String`, `Integer`, `Float`, `nil`, `true`, or `false`. + # You should make sure to only set a new object of one of the basic types + # here, namely `String`, `Integer`, `Float`, `Hash`, `Array`, `nil`, `true`, + # or `false`. class Replace # @param spec [Hash<#to_s => #call,Object>] a `Hash` specifying new field # values for the named keys. Values can be given in the form of a fixed @@ -34,9 +38,7 @@ module Rackstash end end - # Replace field values in the event to a new value. If a specified field - # does not exist in the event hah, it will be created with the goven (or - # calculated) value anyway. + # Replace or set fields in the event to a new value. # # @param event [Hash] an event hash # return [Hash] the given `event` with the fields renamed