 (defmethod ->ruby
   nil [n]
   (-> (ruby) (.getNil)))
+
+(defmethod ->ruby
+  :default [val]
+  (org.jruby.RubyString/newString (ruby) (format "Uncastable values: %s" val)))
 
 (def sample-objectid-string "4ee6911fe4b05e6a4d3605fe")
 

(ns circle.ruby
  (:refer-clojure :exclude [eval send methods])
  (:import org.jruby.RubySymbol)
  (:import java.lang.ref.WeakReference)
  (:use [circle.util.except :only (throw-if-not)])
  (:require fs))

  org.jruby.exceptions.RaiseException [e]
  (.getException e))

;; Exceptions aren't IRubyObjects
(defmethod ->ruby
  java.lang.Exception [e]
  (let [w (StringWriter.)
        pw (PrintWriter. w)]
    (.printStackTrace e pw)
    (.toString w)))

(defmethod ->ruby
  clojure.lang.Sequential [v]
