Class: Hope::Listener::Base
- Includes:
- UpdateListener
- Defined in:
- lib/hope/listener/base.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, *args) ⇒ Base
constructor
A new instance of Base.
- #serializable_hash ⇒ Object
- #update(newEvents, oldEvents) ⇒ Object
Constructor Details
#initialize(name, *args) ⇒ Base
Returns a new instance of Base.
11 12 13 14 |
# File 'lib/hope/listener/base.rb', line 11 def initialize name, *args puts "Initialized new Listener: #{self.class.name}, with args: #{args.inspect}" @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/hope/listener/base.rb', line 9 def name @name end |
Instance Method Details
#serializable_hash ⇒ Object
31 32 33 34 35 36 |
# File 'lib/hope/listener/base.rb', line 31 def serializable_hash { :id => name, :name => name } end |
#update(newEvents, oldEvents) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/hope/listener/base.rb', line 16 def update(newEvents, oldEvents) newEvents.each do |event| puts "[#{@name}] New event (#{event..class}): #{event..toString rescue event..inspect}" end unless newEvents.nil? unless oldEvents.nil? oldEvents.each do |event| puts "[#{@name}] Old Event (#{event..class}): #{event..toString rescue event..inspect}" end else puts "NO oldEvents here..." end end |