# YAML/Syck key pass to add type block?

**URL:** <https://www.ruby-forum.com/t/yaml-syck-key-pass-to-add-type-block/97819>\
**Category:** Ruby\
**Created:** [July 10, 2006, 7:24pm UTC](https://www.ruby-forum.com/t/yaml-syck-key-pass-to-add-type-block/97819 "2006-07-10T19:24:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 10, 2006, 7:24pm UTC](https://www.ruby-forum.com/t/yaml-syck-key-pass-to-add-type-block/97819/1 "2006-07-10T19:24:56Z")

</div>

I’ve had a couple occasions now where having the key of the map node  
(or index for sequence) would have been very helpful in the my type  
defs

* * *

a: !!table  
…

YAML.add\_private\_type(‘table’) { |tag, data|  
Table.new( key, data) # have no key  
}

class Table  
def initialize( name, data )  
@name = name # needs to be ‘a’  
…

Might that be possible in the future – I imagine you’d hav to pass the  
node type too seq or map.

Thanks,  
T.
