Class: Slice::CommandBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/slice/command_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CommandBuilder

Slice::CommandBuilder.new(argv) Creates a new instance of Slice::CommandBuilder from the given command line arguments.



14
15
16
# File 'lib/slice/command_builder.rb', line 14

def initialize(argv)
  @argv = argv
end

Instance Method Details

#callObject

Slice::CommandBuilder#call Returns a new instance of command class that inherits from Slice::Commands::Base.



21
22
23
24
25
26
27
# File 'lib/slice/command_builder.rb', line 21

def call
  if arguments.valid?
    Slice::Commands::Request.new(arguments)
  else
    Slice::Commands::Error.new(arguments)
  end
end