3 Replies Latest reply on Oct 19, 2012 10:46 AM by Jon Tara

    how to intercept controller callback method call?

      I want to implement a AOP-like mechanism for AsyncHttp callback method,  I wonder if there is a way to intercept all the callback methods,

      for example, I want to intercept the callback method, before it get called, I want to do something, then pass the argument to the callback method,

      but since AsynHttp callback is invoked by the lower level in C instead of in Ruby, I wonder if this is possible.


      I will appreciate if some one will bring some insights.



        • Re: how to intercept controller callback method call?
          Peter Arcuri



          Aquarium has a framework that implements Aspect-Oriented Programming (AOP) for Ruby. Perhaps this could prove to be helpful towards achieving your particular programming technique.

            • Re: how to intercept controller callback method call?

              Hi, Peter,


              Thanks for your reply, I will look at the Aquarium, but I am not sure Rhodes platform will support all the ruby features,

              Jon pointed out that we can not use dynamic ruby features in Rhodes, is that true?



                • Re: how to intercept controller callback method call?
                  Jon Tara

                  Rhodes uses YARV (Ruby 1.9 VM) for most implementations. The Ruby is compiled to bytecode. The VM runs the bytecode. The Rhodes runtime includes the VM and parts of the standard Ruby library. It omits the parts that are able to compile Ruby code to bytecode. If they did include these parrts, then Apple would not accept Rhodes apps in the App Store.


                  The code that compiles Ruby to bytecode isn't actually in Ruby, it's in C, so there might be some considerable effort needed to port to all of the platforms, as well.


                  Presumably, this also has impact of the size of the executable, but I don't know how significant that is. If this functionality were restored on those platforms where it is allowed, I dunno how much this would add to executable size, so don't know if this was a major consideration in the design, or if it was predicated only on Apple's restriction.


                  Steve: I think you are over-reaching Rhodes' capabilities. This is all nice, but not practical.