Class: Rubu::Move

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

Overview

Move is the action in Step.

Direct Known Subclasses

RubyCommand, ShellCommand, Step, Trail

Constant Summary

@@host =
[]

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Move) initialize

Returns a new instance of Move



75
76
77
78
79
80
81
# File 'lib/rubu.rb', line 75

def initialize
    @status = :success
    @errmsg = nil
    @output = nil

    @subs = []
end

Instance Attribute Details

- (Object) errmsg (readonly)

Storage for error message.



67
68
69
# File 'lib/rubu.rb', line 67

def errmsg
  @errmsg
end

- (Object) output (readonly)

Command output.



70
71
72
# File 'lib/rubu.rb', line 70

def output
  @output
end

- (Object) status (readonly)

Status after execution.



64
65
66
# File 'lib/rubu.rb', line 64

def status
  @status
end

- (Object) subs (readonly)

Sub actions.



73
74
75
# File 'lib/rubu.rb', line 73

def subs
  @subs
end

Instance Method Details

- (Object) display(msg)

Display command output.



111
112
113
114
# File 'lib/rubu.rb', line 111

def display( msg )
    @output = msg
    STDOUT.puts @output
end

- (Object) error(msg)

Report (and store) error.



105
106
107
108
# File 'lib/rubu.rb', line 105

def error( msg )
    @errmsg = msg
    STDERR.puts "Rubu Error: #{@errmsg}"
end

- (Object) host

Current host.



100
101
102
# File 'lib/rubu.rb', line 100

def host
    @@host[-1]
end

- (Object) host_in

Push host as current to host stack.



90
91
92
# File 'lib/rubu.rb', line 90

def host_in
    @@host.push self
end

- (Object) host_out

Pop host from host stack.



95
96
97
# File 'lib/rubu.rb', line 95

def host_out
    @@host.pop
end

- (Object) use

Register Move to host (upper level).



84
85
86
87
# File 'lib/rubu.rb', line 84

def use
    host.subs.push( self ) if host
    self
end