Sha256: c79ca05eb00c5bcbc6aee134aff381464ca2b07851905c2af0bb982370aa2653

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2020 Eric Crane.  All rights reserved.
#
# The Runner is a static helper function.
# It is used to send the run command to verbs.
#

module GlooLang
  module Exec
    class Runner

      #
      # Dispatch run command to a verb.
      # We abstract this out in case there are things
      # that need to be done before or after a verb
      # is done running.
      #
      def self.go( verb )
        $log.debug "running verb #{verb.type_display}"
        $engine.heap.error.start_tracking
        $engine.exec_env.verbs.push verb
        verb&.run
        $engine.exec_env.verbs.pop
        $engine.heap.error.clear_if_no_errors
      end

      #
      # Send 'run' message to the object.
      # Resolve the path_name and then send the run message.
      #
      def self.run( path_name )
        $log.debug "running script at #{path_name}"
        pn = GlooLang::Core::Pn.new path_name
        o = pn.resolve

        if o
          o.send_message 'run'
        else
          $log.error "Could not send message to object.  Bad path: #{path_name}"
        end
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gloo-lang-0.9.8 lib/gloo_lang/exec/runner.rb
gloo-lang-0.9.7 lib/gloo_lang/exec/runner.rb
gloo-lang-0.9.6 lib/gloo_lang/exec/runner.rb
gloo-lang-0.9.5 lib/gloo_lang/exec/runner.rb
gloo-lang-0.9.4 lib/gloo_lang/exec/runner.rb
gloo-lang-0.9.3 lib/gloo_lang/exec/runner.rb