class Object::Syck::Seq - syck-1.2.0 Documentation

# class Object::Syck::Seq

### Public Class Methods

new(p1, p2, p3) click to toggle source

YAML::Syck::Seq.initialize

    VALUE
    syck_seq_initialize(VALUE self, VALUE type_id, VALUE val, VALUE 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) click to toggle source

YAML::Syck::Seq.add

    VALUE
    syck_seq_add_m(VALUE self, VALUE 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) click to toggle source

YAML::Syck::Seq.style=

    VALUE
    syck_seq_style_set(VALUE self, VALUE 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) click to toggle source

YAML::Syck::Seq.value=

    VALUE
    syck_seq_value_set(VALUE self, VALUE 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_LEN( val ); i++ )
            {
                syck_seq_add( node, rb_ary_entry(val, i) );
            }
        }

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