Sha256: cfb70ae13c6fc1152e9665230c1da4a968542bb4ba5cff94ed8370d6cc045db7

Contents?: true

Size: 985 Bytes

Versions: 9

Compression:

Stored size: 985 Bytes

Contents

module Hyperloop
  # insure at least a stub of operation is defined.  If
  # Hyperloop::Operation is already loaded it will have
  # defined these.
  class Operation
    class << self
      def on_dispatch(&block)
        receivers << block
      end unless method_defined? :on_dispatch

      def receivers
        # use the force: true option so that system code needing to receive
        # boot will NOT be erased on the next Hyperloop::Context.reset!
        Hyperloop::Context.set_var(self, :@receivers, force: true) { [] }
      end unless method_defined? :receivers
    end
  end
  class Application
    class Boot < Operation
      class ReactDummyParams
        attr_reader :context
        def initialize(context)
          @context = context
        end
      end
      def self.run(context: nil)
        params = ReactDummyParams.new(context)
        receivers.each do |receiver|
          receiver.call params
        end
      end
    end unless defined? Boot
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hyper-store-0.99.6 lib/hyperloop/application/boot.rb
hyper-store-0.99.5 lib/hyperloop/application/boot.rb
hyper-store-0.99.4 lib/hyperloop/application/boot.rb
hyper-store-0.99.3 lib/hyperloop/application/boot.rb
hyper-store-0.99.2 lib/hyperloop/application/boot.rb
hyper-store-0.99.1 lib/hyperloop/application/boot.rb
hyper-store-0.99.0 lib/hyperloop/application/boot.rb
hyper-store-1.0.0.lap28 lib/hyperloop/application/boot.rb
hyper-store-0.2.3 lib/hyperloop/application/boot.rb