Class: MisterBin::Command

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, file) ⇒ Command

Returns a new instance of Command.



5
6
7
8
9
# File 'lib/mister_bin/command.rb', line 5

def initialize(command, file)
  @command = command
  @file = file
  @type = command =~ / / ? :secondary : :primary
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



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

def command
  @command
end

#fileObject (readonly)

Returns the value of attribute file.



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

def file
  @file
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#run(argv = []) ⇒ Object



11
12
13
14
15
# File 'lib/mister_bin/command.rb', line 11

def run(argv=[])
  script = Script.new file
  script.build_docopt
  script.execute argv
end