Class: RailsNew::Command
- Inherits:
-
Object
- Object
- RailsNew::Command
- Defined in:
- lib/rails_new/command.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
-
#initialize(*command) ⇒ Command
constructor
A new instance of Command.
- #run ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*command) ⇒ Command
Returns a new instance of Command.
5 6 7 |
# File 'lib/rails_new/command.rb', line 5 def initialize(*command) self.command = command end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
3 4 5 |
# File 'lib/rails_new/command.rb', line 3 def command @command end |
Instance Method Details
#run ⇒ Object
9 10 11 12 13 14 |
# File 'lib/rails_new/command.rb', line 9 def run result = Kernel.system *command unless result raise "Command #{to_s} failed." end end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/rails_new/command.rb', line 16 def to_s command.join(' ') end |