Class: Prepper::Command
- Inherits:
-
Object
- Object
- Prepper::Command
- Defined in:
- lib/prepper/command.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#sudo ⇒ Object
readonly
Returns the value of attribute sudo.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#verifier ⇒ Object
readonly
Returns the value of attribute verifier.
-
#within ⇒ Object
readonly
Returns the value of attribute within.
Instance Method Summary collapse
-
#initialize(command, opts = {}) ⇒ Command
constructor
A new instance of Command.
- #to_s ⇒ Object
Constructor Details
#initialize(command, opts = {}) ⇒ Command
Returns a new instance of Command.
5 6 7 8 9 10 11 12 13 |
# File 'lib/prepper/command.rb', line 5 def initialize(command, opts = {}) @command = command @opts = opts @user = opts[:user] || "root" @within = opts[:within] || "/" @env = opts[:env] || {} @sudo = opts[:sudo] || false @verifier = opts[:verifier] end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/prepper/command.rb', line 3 def command @command end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
3 4 5 |
# File 'lib/prepper/command.rb', line 3 def env @env end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
3 4 5 |
# File 'lib/prepper/command.rb', line 3 def opts @opts end |
#sudo ⇒ Object (readonly)
Returns the value of attribute sudo.
3 4 5 |
# File 'lib/prepper/command.rb', line 3 def sudo @sudo end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
3 4 5 |
# File 'lib/prepper/command.rb', line 3 def user @user end |
#verifier ⇒ Object (readonly)
Returns the value of attribute verifier.
3 4 5 |
# File 'lib/prepper/command.rb', line 3 def verifier @verifier end |
#within ⇒ Object (readonly)
Returns the value of attribute within.
3 4 5 |
# File 'lib/prepper/command.rb', line 3 def within @within end |
Instance Method Details
#to_s ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/prepper/command.rb', line 15 def to_s if @sudo @command.dup.prepend("sudo ") else @command end end |