Class: FakeRedis::Redis::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/fakeredis.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



6
7
8
9
10
11
12
13
14
# File 'lib/fakeredis.rb', line 6

def initialize(options = {})
  @path      = options[:path]
  @host      = options[:host] || "127.0.0.1"
  @port      = (options[:port] || 6379).to_i
  @password  = options[:password]
  @db        = (options[:db] || 0).to_i
  @logger    = options[:logger]
  @reconnect = true
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(command, *args, &block) ⇒ Object



28
29
30
# File 'lib/fakeredis.rb', line 28

def method_missing(command, *args, &block)
  true
end

Instance Attribute Details

#dbObject

Returns the value of attribute db.



5
6
7
# File 'lib/fakeredis.rb', line 5

def db
  @db
end

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/fakeredis.rb', line 5

def host
  @host
end

#loggerObject

Returns the value of attribute logger.



5
6
7
# File 'lib/fakeredis.rb', line 5

def logger
  @logger
end

#passwordObject

Returns the value of attribute password.



5
6
7
# File 'lib/fakeredis.rb', line 5

def password
  @password
end

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/fakeredis.rb', line 5

def path
  @path
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/fakeredis.rb', line 5

def port
  @port
end

#reconnectObject

Returns the value of attribute reconnect.



5
6
7
# File 'lib/fakeredis.rb', line 5

def reconnect
  @reconnect
end

Instance Method Details

#connectObject



20
21
22
# File 'lib/fakeredis.rb', line 20

def connect
  self
end

#connected?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/fakeredis.rb', line 24

def connected?
  true
end

#idObject



16
17
18
# File 'lib/fakeredis.rb', line 16

def id
  "redis://#{@host}:#{@port}/#{@db}"
end