123456789_123456789_123456789_123456789_123456789_

Class: DRb::DRbServer::InvokeMethod

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
Inherits: Object
Defined in: lib/drb/drb.rb,
lib/drb/drb.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(drb_server, client) ⇒ InvokeMethod

[ GitHub ]

  
# File 'lib/drb/drb.rb', line 1633

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

Instance Method Details

#check_insecure_method (private)

[ GitHub ]

  
# File 'lib/drb/drb.rb', line 1672

def check_insecure_method
  @drb_server.check_insecure_method(@obj, @msg_id)
end

#init_with_client (private)

[ GitHub ]

  
# File 'lib/drb/drb.rb', line 1664

def init_with_client
  obj, msg, argv, block = @client.recv_request
  @obj = obj
  @msg_id = msg.intern
  @argv = argv
  @block = block
end

#perform

[ GitHub ]

  
# File 'lib/drb/drb.rb', line 1638

def perform
  @result = nil
  @succ = false
  setup_message

  if @block
    @result = perform_with_block
  else
    @result = perform_without_block
  end
  @succ = true
  case @result
  when Array
    if @msg_id == :to_ary
      @result = DRbArray.new(@result)
    end
  end
  return @succ, @result
rescue NoMemoryError, SystemExit, SystemStackError, SecurityError
  raise
rescue Exception
  @result = $!
  return @succ, @result
end

#perform_without_block (private)

[ GitHub ]

  
# File 'lib/drb/drb.rb', line 1681

def perform_without_block
  if Proc === @obj && @msg_id == :__drb_yield
    if @argv.size == 1
      ary = @argv
    else
      ary = [@argv]
    end
    ary.collect(&@obj)[0]
  else
    @obj.__send__(@msg_id, *@argv)
  end
end

#setup_message (private)

[ GitHub ]

  
# File 'lib/drb/drb.rb', line 1676

def setup_message
  init_with_client
  check_insecure_method
end