Class: DRb::DRbServer::InvokeMethod

Inherits:
Object
  • Object
show all
Includes:
InvokeMethod18Mixin
Defined in:
lib/drb/drb.rb,
lib/drb/drb.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from InvokeMethod18Mixin

#block_yield, #perform_with_block

Constructor Details

#initialize(drb_server, client) ⇒ InvokeMethod

Returns a new instance of InvokeMethod.



1554
1555
1556
1557
1558
# File 'lib/drb/drb.rb', line 1554

def initialize(drb_server, client)
  @drb_server = drb_server
  @safe_level = drb_server.safe_level
  @client = client
end

Instance Method Details

#performObject



1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
# File 'lib/drb/drb.rb', line 1560

def perform
  @result = nil
  @succ = false
  setup_message

  if $SAFE < @safe_level
    info = Thread.current['DRb']
    if @block
      @result = Thread.new {
        Thread.current['DRb'] = info
        $SAFE = @safe_level
        perform_with_block
      }.value
    else
      @result = Thread.new {
        Thread.current['DRb'] = info
        $SAFE = @safe_level
        perform_without_block
      }.value
    end
  else
    if @block
      @result = perform_with_block
    else
      @result = perform_without_block
    end
  end
  @succ = true
  if @msg_id == :to_ary && @result.class == Array
    @result = DRbArray.new(@result)
  end
  return @succ, @result
rescue StandardError, ScriptError, Interrupt
  @result = $!
  return @succ, @result
end