lib/opentelemetry/sdk/internal.rb in opentelemetry-sdk-1.0.2 vs lib/opentelemetry/sdk/internal.rb in opentelemetry-sdk-1.0.3
- old
+ new
@@ -11,19 +11,23 @@
# Internal contains helpers used by the reference implementation.
module Internal
extend self
def boolean?(value)
- value.is_a?(TrueClass) || value.is_a?(FalseClass)
+ value.instance_of?(TrueClass) || value.instance_of?(FalseClass)
end
def valid_key?(key)
key.instance_of?(String)
end
+ def numeric?(value)
+ value.instance_of?(Integer) || value.instance_of?(Float)
+ end
+
def valid_simple_value?(value)
- value.instance_of?(String) || value == false || value == true || value.is_a?(Numeric)
+ value.instance_of?(String) || boolean?(value) || numeric?(value)
end
def valid_array_value?(value)
return false unless value.is_a?(Array)
return true if value.empty?
@@ -32,10 +36,10 @@
when String
value.all? { |v| v.instance_of?(String) }
when TrueClass, FalseClass
value.all? { |v| boolean?(v) }
when Numeric
- value.all? { |v| v.is_a?(Numeric) }
+ value.all? { |v| numeric?(v) }
else
false
end
end