Class: YAML::Syck::Scalar

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

### Methods

new style= value=

### Public Class methods

new(p1, p2, p3)

YAML::Syck::Scalar.initialize

[Source]

    /*
     * YAML::Syck::Scalar.initialize
     */
    VALUE
    syck_scalar_initialize( self, type_id, val, style )
        VALUE self, type_id, val, style;
    {
        rb_iv_set( self, "@kind", sym_scalar );
        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

style=(p1)

YAML::Syck::Scalar.style=

[Source]

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

        if ( NIL_P( style ) )
        {
            node->data.str->style = scalar_none;
        }
        else if ( style == sym_1quote )
        {
            node->data.str->style = scalar_1quote;
        }
        else if ( style == sym_2quote )
        {
            node->data.str->style = scalar_2quote;
        }
        else if ( style == sym_fold )
        {
            node->data.str->style = scalar_fold;
        }
        else if ( style == sym_literal )
        {
            node->data.str->style = scalar_literal;
        }
        else if ( style == sym_plain )
        {
            node->data.str->style = scalar_plain;
        }

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

value=(p1)

YAML::Syck::Scalar.value=

[Source]

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

        StringValue( val );
        node->data.str->ptr = RSTRING(val)->ptr;
        node->data.str->len = RSTRING(val)->len;
        node->data.str->style = scalar_none;

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

[Validate]