Class: DRab::DRabServer::InvokeMethod
- Inherits:
-
Object
- Object
- DRab::DRabServer::InvokeMethod
- Includes:
- InvokeMethod18Mixin
- Defined in:
- lib/drab/drab.rb,
lib/drab/drab.rb
Instance Method Summary collapse
-
#initialize(drab_server, client) ⇒ InvokeMethod
constructor
A new instance of InvokeMethod.
- #perform ⇒ Object
Methods included from InvokeMethod18Mixin
#block_yield, #perform_with_block
Constructor Details
#initialize(drab_server, client) ⇒ InvokeMethod
Returns a new instance of InvokeMethod.
1276 1277 1278 1279 1280 |
# File 'lib/drab/drab.rb', line 1276 def initialize(drab_server, client) @drab_server = drab_server @safe_level = drab_server.safe_level @client = client end |
Instance Method Details
#perform ⇒ Object
1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 |
# File 'lib/drab/drab.rb', line 1282 def perform @result = nil @succ = false if $SAFE < @safe_level info = Thread.current['DRab'] @result = Thread.new { Thread.current['DRab'] = info $SAFE = @safe_level perform_without_block }.value else @result = perform_without_block end @succ = true if @result.class == Array @result = DRabArray.new(@result) end return @succ, @result rescue StandardError, ScriptError, Interrupt @result = $! return @succ, @result end |