# Problem with yaml

**URL:** <https://www.ruby-forum.com/t/problem-with-yaml/113197>\
**Category:** Ruby\
**Created:** [August 28, 2007, 5:25pm UTC](https://www.ruby-forum.com/t/problem-with-yaml/113197 "2007-08-28T17:25:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![unbewusst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/ba9def/32.png) [@unbewusst](https://www.ruby-forum.com/u/unbewusst)\
**Post date:** [August 28, 2007, 5:25pm UTC](https://www.ruby-forum.com/t/problem-with-yaml/113197/1 "2007-08-28T17:25:39Z")

</div>

i’m using a yaml file to save my preferences in a RubyCocoa  
application, however i get :

/usr/lib/ruby/1.8/yaml.rb:347:in `allocate': allocator undefined for Data (TypeError) from /usr/lib/ruby/1.8/yaml.rb:347:in`object\_maker’  
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:36  
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:34:in `call' from /Users/yt/work/RubyCocoa/eSync/build/Release/eSync.app/Contents/ Resources/rb_main.rb:16:in`transfer’  
from /usr/lib/ruby/1.8/yaml.rb:119:in `load' from /usr/lib/ruby/1.8/yaml.rb:119:in`load’  
from /Users/yt/work/RubyCocoa/eSync/build/Release/eSync.app/Contents/  
Resources/SyncDataSource.rb:55:in `initialize’

line 55 :  
o=YAML::load(File.open("#{PREFS\_FILE}"))

THE file :

— !ruby/object:Preferences  
deepness: 2  
root: !ruby/object:Folder  
“ **slave\_nsobj** ”: !ruby/object:Data {}  
enabled: -1  
items:  
- !ruby/object:Folder  
“ **slave\_nsobj** ”: !ruby/object:Data {}  
enabled: -1  
items:  
- !ruby/object:Folder  
“ **slave\_nsobj** ”: !ruby/object:Data {}  
enabled: true  
items: []  
name: Agenda  
path: /Users/yt/Documents/OOo/Agenda  
[…]

i even don’t know where the lines ““ **slave\_nsobj** ”: !ruby/  
object:Data {}” are coming from…

---

<div class="post-metadata">

**Author:** ![unbewusst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/ba9def/32.png) [@unbewusst](https://www.ruby-forum.com/u/unbewusst)\
**Post date:** [August 28, 2007, 5:39pm UTC](https://www.ruby-forum.com/t/problem-with-yaml/113197/2 "2007-08-28T17:39:39Z")

</div>

On 8/28/07, unbewusst [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> from /usr/lib/ruby/1.8/yaml.rb:119:in `load'
> 
> - !ruby/object:Folder
> " __slave_nsobj__": !ruby/object:Data {}
> enabled: true
> items: []
> name: Agenda
> path: /Users/yt/Documents/OOo/Agenda
> 
> ```
> 
> […]
> 
> i even don’t know where the lines ““ **slave\_nsobj** ”: !ruby/  
> object:Data {}” are coming from…

Just a blind guess: yaml doesn’t know how to (de)serialize binary data  
for/from RubyCocoa extension. I guess Data type means binary data that  
is opaque to ruby.  
**slave\_nsobj** is a member attribute of Folder.

If you can look at yaml and RubyCocoa sources, you’d find more (e.g.  
what is \_\_slave…).

---

<div class="post-metadata">

**Author:** ![unbewusst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/ba9def/32.png) [@unbewusst](https://www.ruby-forum.com/u/unbewusst)\
**Post date:** [August 30, 2007, 11:10am UTC](https://www.ruby-forum.com/t/problem-with-yaml/113197/3 "2007-08-30T11:10:48Z")

</div>

On 28 août, 17:39, “Jano S.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > ```
> > from /usr/lib/ruby/1.8/yaml/rubytypes.rb:36
> > 
> > ```
> 
> > ```
> > enabled: -1
> > 
> > ```
> > 
> > object:Data {}" are coming from…
> 
> Just a blind guess: yaml doesn’t know how to (de)serialize binary data  
> for/from RubyCocoa extension. I guess Data type means binary data that  
> is opaque to ruby.  
> **slave\_nsobj** is a member attribute of Folder.
> 
> If you can look at yaml and RubyCocoa sources, you’d find more (e.g.  
> what is \_\_slave…).

OK, thanks i’ll avoid that Data {}

---

<div class="post-metadata">

**Author:** ![unbewusst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/ba9def/32.png) [@unbewusst](https://www.ruby-forum.com/u/unbewusst)\
**Post date:** [August 30, 2007, 3:41pm UTC](https://www.ruby-forum.com/t/problem-with-yaml/113197/4 "2007-08-30T15:41:32Z")

</div>

On 28 août, 17:39, “Jano S.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Just a blind guess: yaml doesn’t know how to (de)serialize binary data  
> for/from RubyCocoa extension. I guess Data type means binary data that  
> is opaque to ruby.  
> **slave\_nsobj** is a member attribute of Folder.

in fact, i’m using severall Folders BUT it is only the outermost  
staying with this “ **slave\_nsobj** ” i’ve carefully verified that my  
Folder class doesn’t use anymore NSSomething…

as for example NSString, i’ve make use of something.to\_s to avoid  
NSString
