Module: Rushmate::TextmateHelper

Included in:
Command
Defined in:
lib/rushmate/textmate_helper.rb

Overview

Rushmate::TextmateHelper provides convenience methods to Environment variables that Textmate exposes to your command

Instance Method Summary collapse

Instance Method Details

#current_lineObject Also known as: tm_current_line

returns the current line in the editor window



6
7
8
# File 'lib/rushmate/textmate_helper.rb', line 6

def current_line
  ENV["TM_CURRENT_LINE"]
end

#current_wordObject Also known as: tm_current_word

returns the current word in the editor window



11
12
13
# File 'lib/rushmate/textmate_helper.rb', line 11

def current_word
  ENV['TM_CURRENT_WORD']
end

#project_directoryObject Also known as: tm_project_directory

returns the directory of the textmate project

return type Rush::Dir



46
47
48
# File 'lib/rushmate/textmate_helper.rb', line 46

def project_directory
  root[ENV['TM_PROJECT_DIRECTORY'] + "/"]
end

#project_directory?Boolean Also known as: tm_project_directory?

indicates if the command was activeted from a file within a textmate project

Returns:

  • (Boolean)


39
40
41
# File 'lib/rushmate/textmate_helper.rb', line 39

def project_directory?
  ENV['TM_PROJECT_DIRECTORY']
end

#selected_textObject Also known as: tm_selected_text

returns the text selected within Textmate



51
52
53
# File 'lib/rushmate/textmate_helper.rb', line 51

def selected_text
  ENV["TM_SELECTED_TEXT"]
end

#tm_directoryObject

returns the directory of the active file in the editor window

return type Rush::Dir



19
20
21
# File 'lib/rushmate/textmate_helper.rb', line 19

def tm_directory
  root[ENV['TM_DIRECTORY'] + "/"]
end

#tm_fileObject

returns the file of the active file in the editor window

return type Rush::File



27
28
29
# File 'lib/rushmate/textmate_helper.rb', line 27

def tm_file
  root[ENV['TM_FILEPATH']]
end

#tm_filenameObject

returns the file name of the active file in the editor window



33
34
35
# File 'lib/rushmate/textmate_helper.rb', line 33

def tm_filename
  ENV["TM_FILENAME"]
end