Sha256: fdbab9b8d031298ba99d81e2945dd9f6a7dd0b486ea8f76fa4b002b2192526f1
Contents?: true
Size: 1006 Bytes
Versions: 25
Compression:
Stored size: 1006 Bytes
Contents
class Tryouts; class Drill; module Sergeant # = API # # The sergeant responsible for running Ruby code (API) drills. # class API attr_reader :output # +opts+ is a Hash with the following optional keys: # # * +:output+ specify a return value. This will be # used if no block is specified for the drill. def initialize(output=nil) @output = output end def run(block, context, &inline) # A Proc object takes precedence over an inline block. runtime = (block.nil? ? inline : block) response = Tryouts::Drill::Reality.new if runtime.nil? response.output = @output else begin response.output = context.instance_eval &runtime rescue => e puts e.message, e.backtrace if Tryouts.verbose > 2 response.etype = e.class response.error = e.message response.trace = e.backtrace end end response end end end; end; end
Version data entries
25 entries across 25 versions & 2 rubygems