Class: RobotVim::CommandGenerator
- Inherits:
-
Object
- Object
- RobotVim::CommandGenerator
- Defined in:
- lib/robot-vim/command_generator.rb
Class Method Summary collapse
- .generate(user_commands, output_file) ⇒ Object
- .record_location_command ⇒ Object
- .vim_close_commands ⇒ Object
- .write_output_file_command(output_file) ⇒ Object
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_command ⇒ Object
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_commands ⇒ Object
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 |