rb_cObject
Define YAML::Syck::Node class
YAML::Syck::Node.transform
VALUE syck_node_transform(VALUE self) { VALUE t; SyckNode *n = NULL; SyckNode *orig_n; Data_Get_Struct(self, SyckNode, orig_n); t = Data_Wrap_Struct( cNode, syck_node_mark, syck_free_node, 0 ); switch (orig_n->kind) { case syck_map_kind: { int i; DATA_PTR(t) = n = syck_alloc_map(); for ( i = 0; i < orig_n->data.pairs->idx; i++ ) { syck_map_add( n, rb_funcall( syck_map_read( orig_n, map_key, i ), s_transform, 0 ), rb_funcall( syck_map_read( orig_n, map_value, i ), s_transform, 0 ) ); } } break; case syck_seq_kind: { int i; DATA_PTR(t) = n = syck_alloc_seq(); for ( i = 0; i < orig_n->data.list->idx; i++ ) { syck_seq_add( n, rb_funcall( syck_seq_read( orig_n, i ), s_transform, 0 ) ); } } break; case syck_str_kind: DATA_PTR(t) = n = syck_new_str2( orig_n->data.str->ptr, orig_n->data.str->len, orig_n->data.str->style ); break; } if ( orig_n->type_id != NULL ) { n->type_id = syck_strndup( orig_n->type_id, strlen( orig_n->type_id ) ); } if ( orig_n->anchor != NULL ) { n->anchor = syck_strndup( orig_n->anchor, strlen( orig_n->anchor ) ); } n->id = t; return rb_funcall( oDefaultResolver, s_node_import, 1, t ); }
YAML::Syck::Node#type_id=
VALUE syck_node_type_id_set(VALUE self, VALUE type_id) { SyckNode *node; Data_Get_Struct( self, SyckNode, node ); S_FREE( node->type_id ); if ( !NIL_P( type_id ) ) { StringValue( type_id ); node->type_id = syck_strndup( RSTRING_PTR(type_id), RSTRING_LEN(type_id) ); } rb_iv_set( self, "@type_id", type_id ); return type_id; }
Commenting is here to help enhance the documentation. For example, sample code, or clarification of the documentation.
If you are posting code samples in your comments, please wrap them in "<pre><code class="ruby" > ... </code></pre>" markup in order to get syntax highlighting.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file a bug report so that it can be corrected for the next release. Thank you.