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
-
#current_line ⇒ Object
(also: #tm_current_line)
returns the current line in the editor window.
-
#current_word ⇒ Object
(also: #tm_current_word)
returns the current word in the editor window.
-
#project_directory ⇒ Object
(also: #tm_project_directory)
returns the directory of the textmate project.
-
#project_directory? ⇒ Boolean
(also: #tm_project_directory?)
indicates if the command was activeted from a file within a textmate project.
-
#selected_text ⇒ Object
(also: #tm_selected_text)
returns the text selected within Textmate.
-
#tm_directory ⇒ Object
returns the directory of the active file in the editor window.
-
#tm_file ⇒ Object
returns the file of the active file in the editor window.
-
#tm_filename ⇒ Object
returns the file name of the active file in the editor window.
Instance Method Details
#current_line ⇒ Object 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_word ⇒ Object 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_directory ⇒ Object 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
39 40 41 |
# File 'lib/rushmate/textmate_helper.rb', line 39 def project_directory? ENV['TM_PROJECT_DIRECTORY'] end |
#selected_text ⇒ Object 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_directory ⇒ Object
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_file ⇒ Object
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_filename ⇒ Object
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 |