lib/qlang/iq.rb in qlang-0.0.27182000 vs lib/qlang/iq.rb in qlang-0.0.27182100
- old
+ new
@@ -1,5 +1,8 @@
+require 'dydx'
+include Dydx
+
module Qlang
module Iq
class Dydx::Algebra::Formula
# FIX:
def to_q
@@ -7,13 +10,13 @@
str.equalize!
end
end
def self.execute(code)
- ruby_code = Q.to_ruby.compile(code)
+ ruby_code = Q.to_ruby.compile(code.encode('utf-8'))
ruby_obj = eval(ruby_code)
- optimize_output(ruby_obj)
+ optimize_output(ruby_obj).encode('utf-8')
rescue SyntaxError
# TODO: emergency
case ruby_code
when /(\d)+(\w)/
execute("#{$1} * #{$2}")