Class: MultiRedis::Data
- Inherits:
-
Object
show all
- Defined in:
- lib/multi_redis.rb
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Data
Returns a new instance of Data.
37
38
39
40
|
# File 'lib/multi_redis.rb', line 37
def initialize
@data = Hash.new
@results = []
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args, &block) ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/multi_redis.rb', line 42
def method_missing symbol, *args, &block
if m = symbol.to_s.match(/\A(.*)\=\Z/)
@data[m[1].to_sym] = args[0]
else
super symbol, *args, &block
end
end
|
Instance Method Details
#resolve_futures! ⇒ Object
50
51
52
53
54
55
|
# File 'lib/multi_redis.rb', line 50
def resolve_futures!
@data.each_key do |k|
self.class.send(:define_method, k){ @data[k].value } if @data[k].is_a? Redis::Future
end
end
|
#to_a ⇒ Object
57
58
59
|
# File 'lib/multi_redis.rb', line 57
def to_a
@results
end
|
#to_a=(results) ⇒ Object
61
62
63
|
# File 'lib/multi_redis.rb', line 61
def to_a= results
@results = results
end
|