Class: FakeRedis::Redis::Client
- Inherits:
-
Object
- Object
- FakeRedis::Redis::Client
- Defined in:
- lib/fakeredis.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
Returns the value of attribute db.
-
#host ⇒ Object
Returns the value of attribute host.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#password ⇒ Object
Returns the value of attribute password.
-
#path ⇒ Object
Returns the value of attribute path.
-
#port ⇒ Object
Returns the value of attribute port.
-
#reconnect ⇒ Object
Returns the value of attribute reconnect.
Instance Method Summary collapse
- #connect ⇒ Object
- #connected? ⇒ Boolean
- #id ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #method_missing(command, *args, &block) ⇒ Object
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( = {}) @path = [:path] @host = [:host] || "127.0.0.1" @port = ([:port] || 6379).to_i @password = [:password] @db = ([:db] || 0).to_i @logger = [: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
#db ⇒ Object
Returns the value of attribute db.
5 6 7 |
# File 'lib/fakeredis.rb', line 5 def db @db end |
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/fakeredis.rb', line 5 def host @host end |
#logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/fakeredis.rb', line 5 def logger @logger end |
#password ⇒ Object
Returns the value of attribute password.
5 6 7 |
# File 'lib/fakeredis.rb', line 5 def password @password end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/fakeredis.rb', line 5 def path @path end |
#port ⇒ Object
Returns the value of attribute port.
5 6 7 |
# File 'lib/fakeredis.rb', line 5 def port @port end |
#reconnect ⇒ Object
Returns the value of attribute reconnect.
5 6 7 |
# File 'lib/fakeredis.rb', line 5 def reconnect @reconnect end |
Instance Method Details
#connect ⇒ Object
20 21 22 |
# File 'lib/fakeredis.rb', line 20 def connect self end |
#connected? ⇒ Boolean
24 25 26 |
# File 'lib/fakeredis.rb', line 24 def connected? true end |
#id ⇒ Object
16 17 18 |
# File 'lib/fakeredis.rb', line 16 def id "redis://#{@host}:#{@port}/#{@db}" end |