Sha256: ff0ce5d3f251e561f1197af4897365fa29c431ac5ee4bbc325396d6666f678eb
Contents?: true
Size: 806 Bytes
Versions: 10
Compression:
Stored size: 806 Bytes
Contents
# frozen_string_literal: true class Code GLOBALS = %i[output error context object].freeze DEFAULT_TIMEOUT = 0 def initialize( input, output: StringIO.new, error: StringIO.new, timeout: DEFAULT_TIMEOUT ) @input = input @output = output @error = error @timeout = timeout || DEFAULT_TIMEOUT @context = Object::Context.new end def self.evaluate( input, output: StringIO.new, error: StringIO.new, timeout: DEFAULT_TIMEOUT ) new(input, output:, error:, timeout:).evaluate end def evaluate Timeout.timeout(timeout) do Node::Code.new(::Code::Parser.parse(input).to_raw).evaluate( context:, output:, error: ) end end private attr_reader :input, :timeout, :output, :error, :context end
Version data entries
10 entries across 10 versions & 1 rubygems