Class: OpenCensus::Trace::TruncatableString

Inherits:
Object
  • Object
show all
Defined in:
lib/opencensus/trace/truncatable_string.rb

Overview

A string that might be shortened to a specified length.

Instance Attribute Summary collapse

Instance Attribute Details

#truncated_byte_countInteger (readonly)

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

Returns:

  • (Integer)


40
41
42
# File 'lib/opencensus/trace/truncatable_string.rb', line 40

def truncated_byte_count
  @truncated_byte_count
end

#valueString (readonly)

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.

Returns:

  • (String)


32
33
34
# File 'lib/opencensus/trace/truncatable_string.rb', line 32

def value
  @value
end