Sha256: 20e10fa8db2072be1d62a52fc6aa7a976f0f5aca8f97c4071e664d3f52873899

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

include_class 'com.espertech.esper.client.UpdateListener'

module Hope
  module Listener  
    class Base
      
      include UpdateListener
      
      attr_reader :name
      
      def initialize name, *args
        puts "Initialized new Listener: #{self.class.name}, with args: #{args.inspect}"
        @name = name
      end
      
      def update(newEvents, oldEvents)
        newEvents.each do |event|
          puts "[#{@name}] New event (#{event.getUnderlying.class}): #{event.getUnderlying.toString rescue event.getUnderlying.inspect}"
        end unless newEvents.nil?
        
        unless oldEvents.nil?
          oldEvents.each do |event|
            puts "[#{@name}] Old Event (#{event.getUnderlying.class}): #{event.getUnderlying.toString rescue event.getUnderlying.inspect}"
          end 
        else
          puts "NO oldEvents here..."
        end
        
      end
      
      def serializable_hash
        {
          :id => name,
          :name => name
        }
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hope-0.1.0-java lib/hope/listener/base.rb