Class: Lumberjack::Formatter::StripFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/lumberjack/formatter/strip_formatter.rb

Overview

Format an object by calling to_s on it and stripping leading and trailing whitespace. This formatter is useful for cleaning up string values that may have unwanted whitespace from user input, file processing, or other sources.

The StripFormatter combines string conversion with whitespace normalization, making it ideal for attribute values that should be clean and consistent in log output.

Instance Method Summary collapse

Instance Method Details

#call(obj) ⇒ String

Convert an object to a string and remove leading and trailing whitespace.

Parameters:

  • obj (Object)

    The object to format.

Returns:

  • (String)

    The string representation with whitespace stripped.



19
20
21
# File 'lib/lumberjack/formatter/strip_formatter.rb', line 19

def call(obj)
  obj.to_s.strip
end