On Oct 27, 4:32 pm, Nels Nelson <[email protected]> wrote:
> That works perfectly!  Thanks Jeremy, you rock.
>
> Indeed, I am using the json_serializer and the xml_serializer
> plugins.  They seem to be working perfectly.
>
> However, the Yecht library seems to be having difficulty rendering
> Model instances to YAML.
>
> model_instance.to_yaml produces:
>
> TypeError: can't dump anonymous class Class
> /usr/java/jruby/lib/ruby/1.8/yaml/rubytypes.rb:56:in `to_yaml'
> org/yecht/ruby/YEmitter.java:52:in `node_export'
> org/yecht/ruby/Map.java:90:in `add'
> /usr/java/jruby/lib/ruby/1.8/yaml/rubytypes.rb:68:in `to_yaml'
>
> Looks like some trouble with yecht.jar?

My guess is you want to call marshallable! on the instance first:

  model_instance.marshallable!.to_yaml

Unlike the json_serializer or xml_serializer plugins, dumping as yaml
is similar to dumping as marshal, in that it just takes the instance
variables as dumps them.  Sequel::Model instances often contain
instances of objects that have been extended with a module and
therefore cannot be marshalled.  Calling marshallable! removes the
stuff that can't be marshalled, so you should be able to call to_yaml
on the resulting instance.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to