In Files
Parent
Included Modules
- CLI
Information
Class Index
- Ratch
- Ratch::Batch
- Ratch::CLI
- Ratch::ConfigUtils
- Ratch::Console
- Ratch::EmailUtils
- Ratch::Emailer
- Ratch::FTPUtils
- Ratch::FileList
- Ratch::FileNotFound
- Ratch::Help
- Ratch::POMUtils
- Ratch::RDocUtils
- Ratch::Script
- Ratch::Shell
- Ratch::System
- Ratch::TarUtils
- Ratch::XDGUtils
- Ratch::ZlibUtils
- FileTest
- Hash
- NilClass
- Object
- String
Script
The Ratch Script class is used to run stand-alone Ratch scripts. Yep, this is actaully a class named exactly for what it is. How rare.
Public Class Methods
execute(script, *args)
click to toggle source
# File lib/ratch/script.rb, line 27 27: def self.execute(script, *args) 28: script = new(script, *args) 29: script.execute! 30: end
new(file, *args)
click to toggle source
# File lib/ratch/script.rb, line 33 33: def initialize(file, *args) 34: @_file = file.to_s 35: 36: #extend self 37: 38: super(*args) 39: 40: #@_stdout = options[:stdout] || $stdout 41: #@_stderr = options[:stderr] || $stderr 42: #@_stdin = options[:stdin] || $stdin 43: end
Public Instance Methods
define_method(name, &block)
click to toggle source
Pass-thru to singleton class.
# File lib/ratch/script.rb, line 94 94: def define_method(name, &block) 95: (class << self; self; end).__send__(:define_method, &block) 96: end
execute!()
click to toggle source
Be cautious about calling this in a script —an infinite loop could easily ensue.
# File lib/ratch/script.rb, line 52 52: def execute! 53: old = $0 54: begin 55: $0 = script_file 56: instance_eval(File.read(script_file), script_file, 1) 57: ensure 58: $0 = old 59: end 60: end
Also aliased as: run!
script_file()
click to toggle source
Returns the file name of the script.
# File lib/ratch/script.rb, line 46 46: def script_file 47: @_file 48: end
Disabled; run with --debug to generate this.