Class: Debugger::Xml::Vim::Interface

Inherits:
Ide::Interface show all
Defined in:
lib/debugger/xml/vim/interface.rb

Instance Attribute Summary

Attributes inherited from Ide::Interface

#command_queue, #histfile, #history_length, #history_save, #restart_file

Instance Method Summary collapse

Methods inherited from Ide::Interface

#close, #confirm, #errmsg, #finalize, #non_blocking_gets, #print_debug, #read_command, #readline_support?

Constructor Details

#initialize(socket, options) ⇒ Interface

Returns a new instance of Interface.



7
8
9
10
11
# File 'lib/debugger/xml/vim/interface.rb', line 7

def initialize(socket, options)
  super(socket)
  @options = options
  @output = []
end

Instance Method Details



13
14
15
16
17
18
# File 'lib/debugger/xml/vim/interface.rb', line 13

def print(*args)
  escaped_args = escape_input(args)
  value = escaped_args.first % escaped_args[1..-1]
  Xml.logger.puts("Going to print: #{value}")
  @output << sprintf(value)
end

#send_responseObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/debugger/xml/vim/interface.rb', line 20

def send_response
  create_directory(@options.file)
  message = @output.join(@options.separator)
  @output.clear
  unless message.empty?
    File.open(@options.file, 'w') do |f|
      f.puts(message)
    end
    Notification.new("receive_command", @options).send
  end
end