Class: SplitIoClient::Cache::Repositories::Metrics::MemoryRepository::ValueAndCount

Inherits:
Object
  • Object
show all
Defined in:
lib/splitclient-rb/cache/repositories/metrics/memory_repository.rb

Overview

small class to act as DTO for gauges

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeValueAndCount

Returns a new instance of ValueAndCount.



108
109
110
111
# File 'lib/splitclient-rb/cache/repositories/metrics/memory_repository.rb', line 108

def initialize
  @count = 0
  @value = 0
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



105
106
107
# File 'lib/splitclient-rb/cache/repositories/metrics/memory_repository.rb', line 105

def count
  @count
end

#valueObject (readonly)

Returns the value of attribute value.



106
107
108
# File 'lib/splitclient-rb/cache/repositories/metrics/memory_repository.rb', line 106

def value
  @value
end

Instance Method Details

#clearObject



118
119
120
121
# File 'lib/splitclient-rb/cache/repositories/metrics/memory_repository.rb', line 118

def clear
  @count = 0
  @value = 0
end

#set_value(value) ⇒ Object



113
114
115
116
# File 'lib/splitclient-rb/cache/repositories/metrics/memory_repository.rb', line 113

def set_value(value)
  @count += 1
  @value = value
end