Class: Lich::Common::ExecScript

Inherits:
Script
  • Object
show all
Defined in:
documented/common/script.rb

Overview

Represents an executable script that can be run within the Lich engine.

This class handles the execution of command scripts.

Constant Summary collapse

@@name_exec_mutex =
Mutex.new

Constants inherited from Script

Script::JUMP, Script::JUMP_ERROR

Instance Attribute Summary collapse

Attributes inherited from Script

#at_exit_procs, #command_line, #current_label, #die_with, #downstream_buffer, #file_name, #hidden, #ignore_pause, #jump_label, #kill_source, #killed_externally, #label_order, #match_stack_labels, #match_stack_strings, #name, #no_echo, #no_kill_all, #no_pause_all, #paused, #quiet, #safe, #silent, #unique_buffer, #upstream_buffer, #vars, #want_downstream, #want_downstream_xml, #want_script_output, #want_upstream, #watchfor

Instance Method Summary collapse

Methods inherited from Script

#at_exit, #clear, #clear_exit_procs, #custom?, #exit, #exit!, #feedme_upstream, #gets, #gets?, #has_thread?, #instance_eval, #instance_variable_get, #kill, #labels, #match_stack_add, #match_stack_clear, #pause, #paused?, #safe?, #thread_group, #to_s, #unique_gets, #unique_gets?, #unpause, #upstream_gets, #upstream_gets?

Constructor Details

#initialize(cmd_data, flags = Hash.new) ⇒ ExecScript

rubocop:disable Lint/MissingSuper



1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
# File 'documented/common/script.rb', line 1005

def initialize(cmd_data, flags = Hash.new)
  @cmd_data = cmd_data
  @custom = false
  @vars = Array.new
  @downstream_buffer = LimitedArray.new
  @downstream_buffer.max_size = 400
  @killer_mutex = Mutex.new
  @want_downstream = true
  @want_downstream_xml = false
  @upstream_buffer = LimitedArray.new
  @want_upstream = false
  @at_exit_procs = Array.new
  @watchfor = Hash.new
  @hidden = false
  @paused = false
  @silent = false
  if flags[:quiet].nil?
    @quiet = false
  else
    @quiet = flags[:quiet]
  end
  @safe = false
  @no_echo = false
  @thread_group = ThreadGroup.new
  @unique_buffer = LimitedArray.new
  @die_with = Array.new
  @no_pause_all = false
  @no_kill_all = false
  @match_stack_labels = Array.new
  @match_stack_strings = Array.new
  if flags[:name].nil?
    num = '1'; num.succ! while @@running.any? { |s| s.name == "exec#{num}" }
    @name = "exec#{num}"
  else
    num = '1'; num.succ! while @@running.any? { |s| s.name == "#{flags[:name]}#{num}" }
    @name = "#{flags[:name]}#{num}"
  end
  @@running.push(self)
end

Instance Attribute Details

#cmd_dataObject (readonly)

Returns the value of attribute cmd_data.



929
930
931
# File 'documented/common/script.rb', line 929

def cmd_data
  @cmd_data
end

Instance Method Details

#get_next_labelObject

rubocop:enable Lint/MissingSuper



1046
1047
1048
1049
# File 'documented/common/script.rb', line 1046

def get_next_label
  echo 'goto labels are not available in exec scripts.'
  nil
end