Sha256: 596a9fa1622bbf80bf3ba7889627dd25a31a812beedf64dacc6e214c123aacb7

Contents?: true

Size: 896 Bytes

Versions: 16

Compression:

Stored size: 896 Bytes

Contents

module Groonga
  module Ruby
    class EvalCommand < Command
      register("ruby_eval",
               [
                 "script",
               ])

      def run_body(input)
        script = input[:script]
        unless script.is_a?(String)
          message = "script must be a string: <#{script.inspect}>"
          raise Groonga::InvalidArgument, message
        end

        eval_context = EvalContext.new
        begin
          result = eval_context.eval(script)
        rescue => error
          writer.map("result", 1) do
            writer.write("exception")
            writer.map("exception", 1) do
              writer.write("message")
              writer.write(error.message)
            end
          end
        else
          writer.map("result", 1) do
            writer.write("value")
            writer.write(result)
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rroonga-7.0.2-x86-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-7.0.2-x64-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.1.3-x64-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.1.3-x86-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.1.0-x86-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.1.0-x64-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.0.9-x64-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.0.9-x86-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.0.7-x86-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.0.7-x64-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.0.5-x64-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.0.5-x86-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.0.4-x86-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.0.4-x64-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.0.2-x64-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb
rroonga-6.0.2-x86-mingw32 vendor/local/lib/groonga/plugins/ruby/eval.rb