class FakeElasticache::Server
Attributes
options[R]
Public Class Methods
new(options)
click to toggle source
Calls superclass method
# File lib/fake_elasticache/server.rb, line 8 def initialize(options) @options = options super end
Public Instance Methods
receive_data(data)
click to toggle source
# File lib/fake_elasticache/server.rb, line 13 def receive_data data if data =~ /stats/i send_data "STAT version #{options[:version]}\nEND\n" elsif data =~ /config get cluster|get AmazonElastiCache:cluster/i send_data config_output elsif data =~ /quit/i close_connection else send_data "Command: #{data} is unexpected\n" end end
Private Instance Methods
config_output()
click to toggle source
# File lib/fake_elasticache/server.rb, line 27 def config_output config_string = options[:servers].join(" ") "CONFIG cluster 0 #{config_string.length}\n1\n#{config_string}\n\nEND\n" end