Skip to content

Instantly share code, notes, and snippets.

@stevenbristol
Created December 24, 2008 00:58
Show Gist options
  • Save stevenbristol/39539 to your computer and use it in GitHub Desktop.
Save stevenbristol/39539 to your computer and use it in GitHub Desktop.
def rubyize obj
return obj unless obj.respond_to?( :java_object)
case obj.java_object.java_type
when "[[Ljava.lang.Long;", "[[Ljava.lang.String;", "[Ljava.lang.Long;", "[Ljava.lang.String;"
obj.map {|o| rubyize o}
when "java.lang.Long"
obj.to_i
when "java.lang.String"
obj.to_s
else
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment