Sha256: efa96fc89d39f79c5128b13127c5e132c36467f13d8cf53011197ff91dfb2c82

Contents?: true

Size: 1.49 KB

Versions: 9

Compression:

Stored size: 1.49 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2020 Eric Crane.  All rights reserved.
#
# The execution environment.
# The current state of running scripts and messaging.
#

module Gloo
  module Exec
    class ExecEnv

      attr_accessor :verbs, :actions, :scripts, :here

      VERB_STACK = 'verbs'.freeze
      ACTION_STACK = 'actions'.freeze
      SCRIPT_STACK = 'scripts'.freeze
      HERE_STACK = 'here'.freeze

      #
      # Set up the execution environment.
      #
      def initialize
        $log.debug 'exec env intialized...'

        @verbs = Gloo::Exec::Stack.new VERB_STACK
        @actions = Gloo::Exec::Stack.new ACTION_STACK
        @scripts = Gloo::Exec::Stack.new SCRIPT_STACK
        @here = Gloo::Exec::Stack.new HERE_STACK
      end

      #
      # Get the here object.
      #
      def here_obj
        return nil if @here.stack.empty?

        return @here.stack.last
      end

      #
      # Push a script onto the stack.
      #
      def push_script( script )
        @scripts.push script
        @here.push script.obj
      end

      #
      # Pop a script off the stack.
      #
      def pop_script
        @scripts.pop
        @here.pop
      end

      #
      # Push an action onto the stack.
      #
      def push_action( action )
        @actions.push action
        # @here.push action.to
      end

      #
      # Pop an action off the stack.
      #
      def pop_action
        @actions.pop
        # @here.pop
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gloo-0.8.0 lib/gloo/exec/exec_env.rb
gloo-0.7.7 lib/gloo/exec/exec_env.rb
gloo-0.7.6 lib/gloo/exec/exec_env.rb
gloo-0.7.5 lib/gloo/exec/exec_env.rb
gloo-0.7.4 lib/gloo/exec/exec_env.rb
gloo-0.7.3 lib/gloo/exec/exec_env.rb
gloo-0.7.2 lib/gloo/exec/exec_env.rb
gloo-0.7.1 lib/gloo/exec/exec_env.rb
gloo-0.7.0 lib/gloo/exec/exec_env.rb