Sha256: 11c496da7f5984d882c95d29c8c517e5b66ee2e08051494b5fab3a018feca41d

Contents?: true

Size: 1.13 KB

Versions: 23

Compression:

Stored size: 1.13 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2020 Eric Crane.  All rights reserved.
#
# Central Message Dispatch.
# Responsible for sending message to objects.
# All object messaging goes through here so we can uniformly
# manage things like checking to make sure object can
# receive the messages sent, handling errors, etc.
#

module GlooLang
  module Exec
    class Dispatch

      #
      # Dispatch the given message to the given object.
      #
      def self.message( engine, msg, to_obj, params = nil )
        engine.log.debug "Dispatch message #{msg} to #{to_obj.name}"
        a = GlooLang::Exec::Action.new msg, to_obj, params
        GlooLang::Exec::Dispatch.action( engine, a )
      end

      #
      # Dispatch an action.
      #
      def self.action( engine, action )
        unless action.valid?
          engine.log.warn "Object #{action.to.name} does not respond to #{action.msg}"
        end

        engine.exec_env.push_action action
        engine.log.debug "Sending message #{action.msg} to #{action.to.name}"
        action.dispatch
        engine.exec_env.pop_action
      end

    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
gloo-lang-1.4.3 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.4.2 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.4.1 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.4.0 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.3.2 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.3.1 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.3.0 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.2.8 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.2.7 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.2.6 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.2.5 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.2.4 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.2.3 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.2.2 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.2.1 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.2.0 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.1.0 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.0.2 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.0.1 lib/gloo_lang/exec/dispatch.rb
gloo-lang-1.0.0 lib/gloo_lang/exec/dispatch.rb