Module: Hijack::Helper

Defined in:
lib/hijack/helper.rb

Class Method Summary collapse

Class Method Details

.find_helper(statements) ⇒ Object



8
9
10
# File 'lib/hijack/helper.rb', line 8

def find_helper(statements)
  helpers.include?(statements.strip) ? statements.strip : nil
end

.helpersObject



4
5
6
# File 'lib/hijack/helper.rb', line 4

def helpers
  methods.find_all {|meth| meth =~ /^hijack_/}.map { |meth| meth.to_s }
end

.helpers_like(str) ⇒ Object



12
13
14
15
# File 'lib/hijack/helper.rb', line 12

def helpers_like(str)
  found = helpers.find_all { |helper| helper =~ Regexp.new(str) }
  found.empty? ? nil : found
end

.hijack_debug_mode(remote) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/hijack/helper.rb', line 27

def hijack_debug_mode(remote)
  hijack_mute(remote)
  require 'rubygems'
  require 'ruby-debug'
  remote.evaluate(<<-RUBY)
    require 'rubygems'
    require 'ruby-debug'
    Debugger.start_remote
  RUBY
  true
end

.hijack_debug_start(remote) ⇒ Object



39
40
41
42
# File 'lib/hijack/helper.rb', line 39

def hijack_debug_start(remote)
  Debugger.start_client
  true
end

.hijack_mute(remote) ⇒ Object



17
18
19
20
# File 'lib/hijack/helper.rb', line 17

def hijack_mute(remote)
  Hijack::OutputReceiver.mute
  true
end

.hijack_unmute(remote) ⇒ Object



22
23
24
25
# File 'lib/hijack/helper.rb', line 22

def hijack_unmute(remote)
  Hijack::OutputReceiver.unmute
  true
end