Sha256: 44ff394a534f7711a12b71aa2eeb5fede0d6e69e98afa9563bffba0cc9f0a37b

Contents?: true

Size: 454 Bytes

Versions: 2

Compression:

Stored size: 454 Bytes

Contents

class SwiftCleanupCrew
  
  def initialize(car)
    @car = car
    @car_exploded_handler = method(:handle_car_on_exploded)
    @car.on_exploded.add @car_exploded_handler
  end
  
  def handle_car_on_exploded(sender, args)
    # logic here to cleanup the street, repair buildings etc.
  end
  
  def dispose
    unless @disposed
      @car.on_exploded.remove @car_exploded_handler
      @disposed = true
    end
  end
  alias :__dispose__ :dispose
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
caricature-0.7.7 spec/fixtures/swift_cleanup_crew.rb
caricature-0.7.6 spec/fixtures/swift_cleanup_crew.rb