Class: Gts::CommandParser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



5
6
7
# File 'lib/gts/command_parser.rb', line 5

def args
  @args
end

#commandObject (readonly)

Returns the value of attribute command.



5
6
7
# File 'lib/gts/command_parser.rb', line 5

def command
  @command
end

Instance Method Details

#iniializeObject



7
8
9
10
# File 'lib/gts/command_parser.rb', line 7

def iniialize
  @command = nil
  @args = [] 
end

#parse(str) ⇒ Object

zatial vieme parsovat iba primitivne veci status last_data known_imeis uptime



17
18
19
20
21
# File 'lib/gts/command_parser.rb', line 17

def parse(str)
  command, *@args = str.split(/\s+/)
  @command = command.to_s.to_sym
  [@command, @args]
end