Class: Redic
- Inherits:
-
Object
- Object
- Redic
- Defined in:
- lib/redic.rb,
lib/redic/client.rb,
lib/redic/connection.rb
Defined Under Namespace
Modules: Connection Classes: Client
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(url = "redis://127.0.0.1:6379") ⇒ Redic
constructor
A new instance of Redic.
- #run ⇒ Object
- #write(*args) ⇒ Object
Constructor Details
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/redic.rb', line 4 def url @url end |
Instance Method Details
#call(*args) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/redic.rb', line 12 def call(*args) @client.connect do @client.write(args) @client.read end end |
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/redic.rb', line 23 def run @client.connect do @buffer.each do |args| @client.write(args) end @buffer.map do @client.read end end ensure @buffer.clear end |
#write(*args) ⇒ Object
19 20 21 |
# File 'lib/redic.rb', line 19 def write(*args) @buffer << args end |