Module: TmHelper

Defined in:
lib/tm_helper/tm_helper.rb

Class Method Summary collapse

Class Method Details

.convert_to_html(string) ⇒ Object



5
6
7
# File 'lib/tm_helper/tm_helper.rb', line 5

def self.convert_to_html string
  CGI.escapeHTML(string).gsub("\n", "<br/>")
end

.running_in_textmate?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/tm_helper/tm_helper.rb', line 17

def self.running_in_textmate?
  ENV["TM_PROJECT_DIRECTORY"] || ENV["TM_FILEPATH"] || ENV["TM_HELPER"]
end

.running_rspec_bundle?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/tm_helper/tm_helper.rb', line 21

def self.running_rspec_bundle?
  defined?(::RSpec::Mate) || defined?(::SpecMate) || ENV["TM_RSPEC"]
end

.textmate_wrap(string) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/tm_helper/tm_helper.rb', line 9

def self.textmate_wrap string
  if self.running_rspec_bundle?
    self.convert_to_html string
  else
    string
  end
end