Class: MyStuff::Fb303::ProxyHandler

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

Instance Method Summary collapse

Constructor Details

#initialize(server) ⇒ ProxyHandler

Returns a new instance of ProxyHandler


6
7
8
# File 'lib/my_stuff/fb303/proxy_handler.rb', line 6

def initialize server
  @s = server
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/my_stuff/fb303/proxy_handler.rb', line 10

def method_missing meth, *args
  @s.increment_counter "#{meth}.called"
  begin
    result = @s.send(meth, *args)
    @s.increment_counter "#{meth}.success"
    result
  rescue => e
    @s.increment_counter "#{meth}.exception"
    @s.increment_counter "#{meth}.exception.#{e.class.name}"
    raise
  end
end