Sha256: 5275cc42448fe10adce4aa116cc7c6601ca58c6f548a4f62c3b6bd86b97078b1

Contents?: true

Size: 925 Bytes

Versions: 8

Compression:

Stored size: 925 Bytes

Contents

module Hyperloop
  # Tricky business here. Hyperloop::Store will define boot
  # if it is not already defined.  It creates a minimal compatible
  # API that includes the run and on_dispatch methods.  This way
  # you can use the Boot interface without loading operations.

  # Here we define Boot, but in case it has already been defined
  # we make sure to run the inherited method, and define the
  # on_dispatch and run methods.   Finally we copy any receivers
  # that may have been defined on the existing Boot to the new class.
  class Application
    Operation.inherited(Boot) if defined? Boot
    class Boot < Operation
      def self.on_dispatch(&block)
        _Railway.add_receiver(&block)
      end
      def self.run(*args)
        ClientDrivers.initialize_client_drivers_on_boot
        _run(*args)
      end
    end
    Boot.receivers.each { |r| Boot.on_dispatch(&r) } if Boot.respond_to? :receivers
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hyper-operation-0.99.6 lib/hyper-operation/boot.rb
hyper-operation-0.99.5 lib/hyper-operation/boot.rb
hyper-operation-0.99.4 lib/hyper-operation/boot.rb
hyper-operation-0.99.3 lib/hyper-operation/boot.rb
hyper-operation-0.99.2 lib/hyper-operation/boot.rb
hyper-operation-0.99.1 lib/hyper-operation/boot.rb
hyper-operation-0.99.0 lib/hyper-operation/boot.rb
hyper-operation-1.0.0.lap28 lib/hyper-operation/boot.rb