Class: Sentry::Metrics::SetMetric
- Defined in:
- lib/sentry/metrics/set_metric.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #add(value) ⇒ Object
-
#initialize(value) ⇒ SetMetric
constructor
A new instance of SetMetric.
- #serialize ⇒ Object
- #weight ⇒ Object
Constructor Details
#initialize(value) ⇒ SetMetric
Returns a new instance of SetMetric.
11 12 13 |
# File 'lib/sentry/metrics/set_metric.rb', line 11 def initialize(value) @value = Set[value] end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/sentry/metrics/set_metric.rb', line 9 def value @value end |
Instance Method Details
#add(value) ⇒ Object
15 16 17 |
# File 'lib/sentry/metrics/set_metric.rb', line 15 def add(value) @value << value end |
#serialize ⇒ Object
19 20 21 |
# File 'lib/sentry/metrics/set_metric.rb', line 19 def serialize value.map { |x| x.is_a?(String) ? Zlib.crc32(x) : x.to_i } end |
#weight ⇒ Object
23 24 25 |
# File 'lib/sentry/metrics/set_metric.rb', line 23 def weight value.size end |