Class: EdrGen

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

Constant Summary collapse

HELP =
'help'
EXEC =
'exec'
CREATE =
'create'
DELETE =
'delete'
MODIFY =
'modify'
TRANSMIT =
'transmit'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ EdrGen

Returns a new instance of EdrGen.



15
16
17
18
# File 'lib/edr_gen.rb', line 15

def initialize(args)
  @command           = args[0]
  @command_arguments = args[1..-1]
end

Class Method Details

.run(args) ⇒ Object



11
12
13
# File 'lib/edr_gen.rb', line 11

def self.run(args)
  new(args).run
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/edr_gen.rb', line 20

def run
  case command
  when HELP
    help_message
  when EXEC
    ForeignExecutable.new(command_arguments).call
  when CREATE
    CreateFile.new(command_arguments).call
  when MODIFY
    ModifyFile.new(command_arguments).call
  when DELETE
    DeleteFile.new(command_arguments).call
  when TRANSMIT
    TcpTransmit.new(command_arguments).call
  else
    puts "Invalid command. For a list of valid commands, run #{Rainbow("edr_gen help").color(:yellow)}"
  end
end