lib/opentracing/reference.rb in opentracing-0.3.1 vs lib/opentracing/reference.rb in opentracing-0.3.2
- old
+ new
@@ -22,14 +22,11 @@
# child_span = OpenTracing.start_span('child operation', references: [
# OpenTracing::Reference.child_of(root_span)
# ])
#
def self.child_of(context)
- if context.is_a?(Span)
- context = context.context
- end
-
+ context = context.context if context.is_a?(Span)
Reference.new(CHILD_OF, context)
end
# @param context [SpanContext, Span] follows_from context refers to a
# parent Span that does not depend in any way on the result of the new
@@ -61,28 +58,21 @@
# span = OpenTracing.start_span('following operation', references: [
# OpenTracing::Reference.follows_from(context)
# ])
#
def self.follows_from(context)
- if context.is_a?(Span)
- context = context.context
- end
-
+ context = context.context if context.is_a?(Span)
Reference.new(FOLLOWS_FROM, context)
end
def initialize(type, context)
@type = type
@context = context
end
- # Return [String] reference type
- def type
- @type
- end
+ # @return [String] reference type
+ attr_reader :type
# @return [SpanContext] the context of a span this reference is referencing
- def context
- @context
- end
+ attr_reader :context
end
end