class Trace::SpanId
Constants
- HEX_REGEX
- MASK
- MAX_SIGNED_I64
Public Class Methods
from_value(v)
click to toggle source
# File lib/zipkin-tracer/trace.rb, line 80 def self.from_value(v) if v.is_a?(String) && v =~ HEX_REGEX # drops any bits higher than 64 by selecting right-most 16 characters new(v.length > 16 ? v[v.length - 16, 16].hex : v.hex) elsif v.is_a?(Numeric) new(v) elsif v.is_a?(SpanId) v end end
new(value)
click to toggle source
# File lib/zipkin-tracer/trace.rb, line 91 def initialize(value) @value = value @i64 = if @value > MAX_SIGNED_I64 -1 * ((@value ^ MASK) + 1) else @value end end
Public Instance Methods
to_i()
click to toggle source
# File lib/zipkin-tracer/trace.rb, line 101 def to_i; @i64; end
to_s()
click to toggle source
# File lib/zipkin-tracer/trace.rb, line 100 def to_s; "%016x" % @value; end