Class | YAML::Syck::Seq
In: | syck/rubyext.c
Parent: | YAML::Syck::Node

### Methods

add new style= value=

### Public Class methods

new(p1, p2, p3)

YAML::Syck::Seq.initialize

[Source]

    /*
     * YAML::Syck::Seq.initialize
     */
    VALUE
    syck_seq_initialize( self, type_id, val, style )
        VALUE self, type_id, val, style;
    {
        SyckNode *node;
        Data_Get_Struct( self, SyckNode, node );

        rb_iv_set( self, "@kind", sym_seq );
        rb_funcall( self, s_type_id_set, 1, type_id );
        rb_funcall( self, s_value_set, 1, val );
        rb_funcall( self, s_style_set, 1, style );
        return self;
    }

### Public Instance methods

add(p1)

YAML::Syck::Seq.add

[Source]

    /*
     * YAML::Syck::Seq.add
     */
    VALUE
    syck_seq_add_m( self, val )
        VALUE self, val;
    {
        SyckNode *node;
        VALUE emitter = rb_ivar_get( self, s_emitter );
        Data_Get_Struct( self, SyckNode, node );

        if ( rb_respond_to( emitter, s_node_export ) ) {
            val = rb_funcall( emitter, s_node_export, 1, val );
        }
        syck_seq_add( node, val );
        rb_ary_push( rb_ivar_get( self, s_value ), val );

        return self;
    }

style=(p1)

YAML::Syck::Seq.style=

[Source]

    /*
     * YAML::Syck::Seq.style=
     */
    VALUE
    syck_seq_style_set( self, style )
        VALUE self, style;
    {
        SyckNode *node;
        Data_Get_Struct( self, SyckNode, node );

        if ( style == sym_inline )
        {
            node->data.list->style = seq_inline;
        }
        else
        {
            node->data.list->style = seq_none;
        }

        rb_iv_set( self, "@style", style );
        return self;
    }

value=(p1)

YAML::Syck::Seq.value=

[Source]

    /*
     * YAML::Syck::Seq.value=
     */
    VALUE
    syck_seq_value_set( self, val )
        VALUE self, val;
    {
        SyckNode *node;
        Data_Get_Struct( self, SyckNode, node );

        val = rb_check_array_type( val );
        if ( !NIL_P( val ) ) {
            int i;
            syck_seq_empty( node );
            for ( i = 0; i < RARRAY( val )->len; i++ )
            {
                syck_seq_add( node, rb_ary_entry(val, i) );
            }
        }

        rb_iv_set( self, "@value", val );
        return val;
    }

[Validate]