Module: Command

Defined in:
lib/ext/savage/spec/shared/command.rb

Instance Method Summary collapse

Instance Method Details

#extract_command(command_string) ⇒ Object



10
11
12
# File 'lib/ext/savage/spec/shared/command.rb', line 10

def extract_command(command_string)
  command_string[0,1]
end

#extract_coordinates(command_string) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/ext/savage/spec/shared/command.rb', line 2

def extract_coordinates(command_string)
  coordinates = []
  command_string.scan /-?\d+(\.\d+)?/ do |match_group|
    coordinates << $&.to_f
  end
  coordinates
end