Module: OpenTelemetry::SDK::Internal Private
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Internal contains helpers used by the reference implementation.
Instance Method Summary collapse
- #boolean?(value) ⇒ Boolean private
- #valid_array_value?(value) ⇒ Boolean private
- #valid_attributes?(attrs) ⇒ Boolean private
- #valid_key?(key) ⇒ Boolean private
- #valid_simple_value?(value) ⇒ Boolean private
- #valid_value?(value) ⇒ Boolean private
Instance Method Details
#boolean?(value) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/opentelemetry/sdk/internal.rb', line 15 def boolean?(value) value.is_a?(TrueClass) || value.is_a?(FalseClass) end |
#valid_array_value?(value) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/opentelemetry/sdk/internal.rb', line 27 def valid_array_value?(value) return false unless value.is_a?(Array) return true if value.empty? case value.first 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) } else false end end |
#valid_attributes?(attrs) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/opentelemetry/sdk/internal.rb', line 47 def valid_attributes?(attrs) attrs.nil? || attrs.all? { |k, v| valid_key?(k) && valid_value?(v) } end |
#valid_key?(key) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/opentelemetry/sdk/internal.rb', line 19 def valid_key?(key) key.instance_of?(String) end |
#valid_simple_value?(value) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/opentelemetry/sdk/internal.rb', line 23 def valid_simple_value?(value) value.instance_of?(String) || value == false || value == true || value.is_a?(Numeric) end |
#valid_value?(value) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 |
# File 'lib/opentelemetry/sdk/internal.rb', line 43 def valid_value?(value) valid_simple_value?(value) || valid_array_value?(value) end |