Sha256: 86be3e8f8b6644daf6b1354b8b56852c8c5ca45fb324d64a8494ae45abf872b4

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

require "celluloid" unless $TESTING

module Tennis
  module Actor

    module ClassMethods
      def new_link(*args)
        new(*args)
      end

      def trap_exit(*args)
      end
    end

    module InstanceMethods
      def current_actor
        self
      end

      def after(interval)
        yield
      end

      def alive?
        @dead = false unless defined?(@dead)
        !@dead
      end

      def terminate
        @dead = true
      end

      def async
        self
      end
    end

    # :nocov:
    def self.included(klass)
      if $TESTING
        klass.include InstanceMethods
        klass.extend ClassMethods
      else
        klass.include Celluloid
      end
    end
    # :nocov:
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tennis-jobs-0.4.0 lib/tennis/actor.rb