AMP protocol implementation in Ruby