Class: Reviewr::CLI::Main
- Inherits:
-
Object
- Object
- Reviewr::CLI::Main
- Defined in:
- lib/reviewr/cli/main.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#c ⇒ Object
readonly
Returns the value of attribute c.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
- #build_command ⇒ Object
-
#initialize(args, input = STDIN, output = STDOUT) ⇒ Main
constructor
A new instance of Main.
- #run ⇒ Object
Constructor Details
#initialize(args, input = STDIN, output = STDOUT) ⇒ Main
Returns a new instance of Main.
9 10 11 12 13 14 15 16 17 |
# File 'lib/reviewr/cli/main.rb', line 9 def initialize(args, input = STDIN, output = STDOUT) @command = args.shift if @command == "-p" Git.instance = PretendGit.new(output) @command = args.shift end @arguments = args @input, @output = input, output end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
7 8 9 |
# File 'lib/reviewr/cli/main.rb', line 7 def arguments @arguments end |
#c ⇒ Object (readonly)
Returns the value of attribute c.
6 7 8 |
# File 'lib/reviewr/cli/main.rb', line 6 def c @c end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
6 7 8 |
# File 'lib/reviewr/cli/main.rb', line 6 def command @command end |
Instance Method Details
#build_command ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/reviewr/cli/main.rb', line 23 def build_command unless @c case command when "request" @c = Request.new(Project.new, @input, @output) when "accept" @c = Accept.new(Project.new, @input, @output) else @c = Help.new(Project.new, @input, @output) end @c.arguments = arguments end @c end |
#run ⇒ Object
19 20 21 |
# File 'lib/reviewr/cli/main.rb', line 19 def run build_command.call end |