Class: Rubu::Move
- Inherits:
-
Object
- Object
- Rubu::Move
- Defined in:
- lib/rubu.rb
Overview
Move is the action in Step.
Direct Known Subclasses
Constant Summary collapse
- @@host =
[]
Instance Attribute Summary collapse
-
#errmsg ⇒ Object
readonly
Storage for error message.
-
#output ⇒ Object
readonly
Command output.
-
#status ⇒ Object
readonly
Status after execution.
-
#subs ⇒ Object
readonly
Sub actions.
Instance Method Summary collapse
-
#display(msg) ⇒ Object
Display command output.
-
#error(msg) ⇒ Object
Report (and store) error.
-
#host ⇒ Object
Current host.
-
#host_in ⇒ Object
Push host as current to host stack.
-
#host_out ⇒ Object
Pop host from host stack.
-
#initialize ⇒ Move
constructor
A new instance of Move.
-
#use ⇒ Object
Register Move to host (upper level).
-
#warn(msg) ⇒ Object
Report warning.
Constructor Details
#initialize ⇒ Move
Returns a new instance of Move
76 77 78 79 80 81 82 |
# File 'lib/rubu.rb', line 76 def initialize @status = :success @errmsg = nil @output = nil @subs = [] end |
Instance Attribute Details
#errmsg ⇒ Object (readonly)
Storage for error message.
68 69 70 |
# File 'lib/rubu.rb', line 68 def errmsg @errmsg end |
#output ⇒ Object (readonly)
Command output.
71 72 73 |
# File 'lib/rubu.rb', line 71 def output @output end |
#status ⇒ Object (readonly)
Status after execution.
65 66 67 |
# File 'lib/rubu.rb', line 65 def status @status end |
#subs ⇒ Object (readonly)
Sub actions.
74 75 76 |
# File 'lib/rubu.rb', line 74 def subs @subs end |
Instance Method Details
#display(msg) ⇒ Object
Display command output.
117 118 119 120 |
# File 'lib/rubu.rb', line 117 def display( msg ) @output = msg STDOUT.puts @output end |
#error(msg) ⇒ Object
Report (and store) error.
106 107 108 109 |
# File 'lib/rubu.rb', line 106 def error( msg ) @errmsg = msg STDERR.puts "Rubu Error: #{@errmsg}" end |
#host ⇒ Object
Current host.
101 102 103 |
# File 'lib/rubu.rb', line 101 def host @@host[-1] end |
#host_in ⇒ Object
Push host as current to host stack.
91 92 93 |
# File 'lib/rubu.rb', line 91 def host_in @@host.push self end |
#host_out ⇒ Object
Pop host from host stack.
96 97 98 |
# File 'lib/rubu.rb', line 96 def host_out @@host.pop end |
#use ⇒ Object
Register Move to host (upper level).
85 86 87 88 |
# File 'lib/rubu.rb', line 85 def use host.subs.push( self ) if host self end |
#warn(msg) ⇒ Object
Report warning.
112 113 114 |
# File 'lib/rubu.rb', line 112 def warn( msg ) STDERR.puts "Rubu Warning: #{msg}" end |