Class: HQ::Tools::BaseScript
- Inherits:
-
Object
- Object
- HQ::Tools::BaseScript
- Defined in:
- lib/hq/tools/base-script.rb
Overview
This class provides a base for creating objects which can be either run as standalone scripts or invoked directly from another ruby script, for testing or other purposes.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#args ⇒ Object
Should be set to the args the script was invoked with before calling #main.
-
#status ⇒ Object
readonly
Will contain the script's exit status after calling #main.
-
#stderr ⇒ Object
The IO object to treat as stderr.
-
#stdout ⇒ Object
The IO object to treat as stdout.
Instance Method Summary collapse
-
#initialize ⇒ BaseScript
constructor
Creates a new base script object with default field values.
-
#main ⇒ Object
Does nothing.
Constructor Details
#initialize ⇒ BaseScript
Creates a new base script object with default field values
29 30 31 32 33 34 |
# File 'lib/hq/tools/base-script.rb', line 29 def initialize @args = [] @status = 0 @stdout = $stdout @stderr = $stderr end |
Instance Attribute Details
#args ⇒ Object
Should be set to the args the script was invoked with before calling #main.
13 14 15 |
# File 'lib/hq/tools/base-script.rb', line 13 def args @args end |
#status ⇒ Object (readonly)
Will contain the script's exit status after calling #main
17 18 19 |
# File 'lib/hq/tools/base-script.rb', line 17 def status @status end |
#stderr ⇒ Object
The IO object to treat as stderr.
25 26 27 |
# File 'lib/hq/tools/base-script.rb', line 25 def stderr @stderr end |
#stdout ⇒ Object
The IO object to treat as stdout.
21 22 23 |
# File 'lib/hq/tools/base-script.rb', line 21 def stdout @stdout end |
Instance Method Details
#main ⇒ Object
Does nothing. This should be overriden by derived classes.
38 39 |
# File 'lib/hq/tools/base-script.rb', line 38 def main end |