Class: RailsNew::Command

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commandObject

Returns the value of attribute command.



3
4
5
# File 'lib/rails_new/command.rb', line 3

def command
  @command
end

Instance Method Details

#runObject



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_sObject



16
17
18
# File 'lib/rails_new/command.rb', line 16

def to_s
  command.join(' ')
end