Class: Redis::ReceiptedPipeline::Receipt

Inherits:
Object
  • Object
show all
Defined in:
lib/redis/structured-multi.rb

Instance Method Summary collapse

Constructor Details

#initialize(pipeline, token, commands = nil) ⇒ Receipt

Returns a new instance of Receipt.



7
8
9
10
11
# File 'lib/redis/structured-multi.rb', line 7

def initialize(pipeline, token, commands = nil)
  @pipeline = pipeline
  @token = token
  @commands = (commands or [])
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &bl) ⇒ Object



21
22
23
24
# File 'lib/redis/structured-multi.rb', line 21

def method_missing(m, *args, &bl)
  new_command = [m, args, bl]
  self.class.new(@pipeline, @token, @commands + [new_command])
end

Instance Method Details

#===(o) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/redis/structured-multi.rb', line 13

def ===( o )
  if o.kind_of? Thunk
    @pipeline.equal?(o.pipeline)
  else
    super
  end
end