Sha256: 8edecc5501e469ccc83865d53b7f61fcdf13a8b144836b4d8c58bc7636fb274c
Contents?: true
Size: 708 Bytes
Versions: 1
Compression:
Stored size: 708 Bytes
Contents
class Code def initialize(input, io: $stdout, timeout: 10) @input = input @parsed = Timeout::timeout(timeout) do ::Code::Parser::Code.new.parse(@input) end @io = io @timeout = timeout end def self.evaluate(input, context = "", io: $stdout, timeout: 10) new(input, io: io, timeout: timeout).evaluate(context) end def evaluate(context = "") Timeout::timeout(@timeout) do if context.present? context = ::Code.evaluate(context, timeout: @timeout) else context = ::Code::Object::Dictionnary.new end ::Code::Node::Code.new(parsed).evaluate(context: context, io: @io) end end private attr_reader :input, :parsed end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
template-ruby-0.2.3 | lib/code.rb |