class OpenCensus::Trace::TruncatableString

A string that might be shortened to a specified length.

Attributes

truncated_byte_count[R]

The number of bytes removed from the original string. If this value is 0, then the string was not shortened.

@return [Integer]

value[R]

The shortened string. For example, if the original string was 500 bytes long and the limit of the string was 128 bytes, then this value contains the first 128 bytes of the 500-byte string. Note that truncation always happens on a character boundary, to ensure that a truncated string is still valid UTF-8. Because it may contain multi-byte characters, the size of the truncated string may be less than the truncation limit.

@return [String]

Public Class Methods

new(value, truncated_byte_count: 0) click to toggle source

Create an empty TruncatableString object.

@private

# File lib/opencensus/trace/truncatable_string.rb, line 47
def initialize value, truncated_byte_count: 0
  @value = value
  @truncated_byte_count = truncated_byte_count
end

Public Instance Methods

to_s() click to toggle source

Override the default to_s implementation.

@private

# File lib/opencensus/trace/truncatable_string.rb, line 57
def to_s
  @value
end