Class: Debugger::TextMateCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug/commands/tmate.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, #find, inherited, #initialize, load_commands, #match, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



27
28
29
30
31
32
# File 'lib/ruby-debug/commands/tmate.rb', line 27

def help(cmd)
  %{
    tm[ate] n\topens a current file in TextMate. 
    \t\tIt uses n-th frame if arg (n) is specifed.
  }
end

.help_commandObject



23
24
25
# File 'lib/ruby-debug/commands/tmate.rb', line 23

def help_command
  'tmate'
end

Instance Method Details

#executeObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ruby-debug/commands/tmate.rb', line 8

def execute
  if @match[1]
    frm_n = @match[1].to_i
    if frm_n > @state.context.stack_size || frm_n == 0
      print pr("tmate.errors.wrong_frame")
      return
    end
    file, line = @state.context.frame_file(frm_n-1), @state.context.frame_line(frm_n-1)
  else
    file, line = @state.file, @state.line
  end
  %x|open 'txmt://open?url=file://#{File.expand_path(file)}&line=#{line}'|
end

#regexpObject



4
5
6
# File 'lib/ruby-debug/commands/tmate.rb', line 4

def regexp
  /^\s*tm(?:ate)?(?:\s*(\d+))?$/
end