Class: MyStuff::Fb303::ResilientProcessor::SpyIProt

Inherits:
Object
  • Object
show all
Defined in:
lib/my_stuff/fb303/resilient_processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(iprot) ⇒ SpyIProt

Returns a new instance of SpyIProt.



10
11
12
13
# File 'lib/my_stuff/fb303/resilient_processor.rb', line 10

def initialize iprot
  @iprot = iprot
  @mode = :capture
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



31
32
33
# File 'lib/my_stuff/fb303/resilient_processor.rb', line 31

def method_missing *args
  @iprot.send *args
end

Instance Method Details

#read_message_beginObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/my_stuff/fb303/resilient_processor.rb', line 15

def read_message_begin
  case @mode
  when :capture
    @header = @iprot.read_message_begin
    @mode = :replay
    @header
  when :replay
    @mode = :normal
    @header
  when :normal
    @iprot.read_message_begin
  else
    raise "Reached a bad state: %s" % @mode
  end
end