Class: RobotVim::CommandGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/robot-vim/command_generator.rb

Class Method Summary collapse

Class Method Details

.generate(user_commands, output_file) ⇒ Object



3
4
5
6
7
8
# File 'lib/robot-vim/command_generator.rb', line 3

def self.generate(user_commands, output_file)
  user_commands +
    record_location_command +
    write_output_file_command(output_file) +
    vim_close_commands
end

.record_location_commandObject



14
15
16
17
18
19
20
# File 'lib/robot-vim/command_generator.rb', line 14

def self.record_location_command
  ":let current_line = line(\".\")\n" +
  ":let current_column = col(\".\")\n" +
  ":normal! G\n" +
  ":execute \"normal! o\" . current_line\n" +
  ":execute \"normal! o\" . current_column\n"
end

.vim_close_commandsObject



22
23
24
# File 'lib/robot-vim/command_generator.rb', line 22

def self.vim_close_commands
  ":%bd!\n:q!\n"
end

.write_output_file_command(output_file) ⇒ Object



10
11
12
# File 'lib/robot-vim/command_generator.rb', line 10

def self.write_output_file_command(output_file)
  ":w #{output_file}\n"
end