Sha256: b2c99841a8b18cb8c38ab5430228f1c95b1364fb750b82a50987c568a71e4290

Contents?: true

Size: 329 Bytes

Versions: 3

Compression:

Stored size: 329 Bytes

Contents

module Qlang
  module Iq
    def execute(code)
      ruby_obj = eval Q.to_ruby.compile(code)
      case ruby_obj
      when Matrix, Vector
        ruby_obj.to_q
      when Float::INFINITY
        'oo'
      when - Float::INFINITY
        '-oo'
      else
        ruby_obj
      end
    end
    module_function :execute
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
qlang-0.0.14142 lib/qlang/iq.rb
qlang-0.0.1414 lib/qlang/iq.rb
qlang-0.0.141 lib/qlang/iq.rb