Class: Hijack::Workspace
- Inherits:
-
IRB::WorkSpace
- Object
- IRB::WorkSpace
- Hijack::Workspace
- Defined in:
- lib/hijack/workspace.rb
Instance Attribute Summary collapse
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#remote ⇒ Object
Returns the value of attribute remote.
Instance Method Summary collapse
Instance Attribute Details
#pid ⇒ Object
Returns the value of attribute pid.
13 14 15 |
# File 'lib/hijack/workspace.rb', line 13 def pid @pid end |
#remote ⇒ Object
Returns the value of attribute remote.
13 14 15 |
# File 'lib/hijack/workspace.rb', line 13 def remote @remote end |
Instance Method Details
#evaluate(context, statements, file = __FILE__, line = __LINE__) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hijack/workspace.rb', line 14 def evaluate(context, statements, file = __FILE__, line = __LINE__) if statements =~ /IRB\./ super elsif statements.strip =~ /^(exit|quit)/ remote.evaluate('Hijack.stop') rescue nil super elsif helper = Hijack::Helper.find_helper(statements) Hijack::Helper.send(helper, remote) else begin result = remote.evaluate(statements) rescue DRb::DRbConnError => e puts "=> Lost connection to #{@pid}!" exit 1 end if result.kind_of?(DRb::DRbUnknown) puts "=> Hijack: Unable to dump unknown object type '#{result.name}', try inspecting it instead." return nil end result end end |