Class: Dalli::Elasticache::AutoDiscovery::StatsResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/dalli/elasticache/auto_discovery/stats_response.rb

Overview

This class wraps the raw ASCII response from a stats call to an Auto Discovery endpoint and provides methods for extracting data from that response.

docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/AutoDiscovery.AddingToYourClientLibrary.html

Constant Summary collapse

VERSION_REGEX =

Matches the version line of the response

/^STAT version ([0-9.]+|unknown)\s*/i.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_text) ⇒ StatsResponse

Returns a new instance of StatsResponse.



18
19
20
# File 'lib/dalli/elasticache/auto_discovery/stats_response.rb', line 18

def initialize(response_text)
  @text = response_text.to_s
end

Instance Attribute Details

#textObject (readonly)

The raw response text



13
14
15
# File 'lib/dalli/elasticache/auto_discovery/stats_response.rb', line 13

def text
  @text
end

Instance Method Details

#engine_versionObject

Extract the engine version stat

Returns a string



25
26
27
28
29
30
# File 'lib/dalli/elasticache/auto_discovery/stats_response.rb', line 25

def engine_version
  m = VERSION_REGEX.match(@text)
  return '' unless m && m[1]

  m[1]
end