Class: Swat::Script

Inherits:
Object
  • Object
show all
Defined in:
lib/swat.rb

Overview

An executable script

Loads the script from file system using ruby’s ‘require` command, then creates a ::Swat::Command and then calls `run` on it

If a Swat::Command object cannot be found (NameError) the command is considered bogus.

Instance Method Summary collapse

Constructor Details

#initialize(parameters, scripts_path = ) ⇒ Script

Returns a new instance of Script.



104
105
106
107
# File 'lib/swat.rb', line 104

def initialize(parameters, scripts_path = ENV["SCRIPTS_LOCAL_PATH"])
  @parameters = parameters
  @scripts_path = Pathname.new(scripts_path || "scripts")
end

Instance Method Details

#runObject



109
110
111
# File 'lib/swat.rb', line 109

def run
  CommandExecution.new(create_command, @parameters.execution_mode).run
end