Class: Object::Syck::Scalar
Instance Method Summary collapse
-
#initialize ⇒ Object
constructor
YAML::Syck::Scalar.initialize.
-
#style= ⇒ Object
YAML::Syck::Scalar.style=.
-
#value= ⇒ Object
YAML::Syck::Scalar.value=.
Constructor Details
#initialize ⇒ Object
YAML::Syck::Scalar.initialize
1443 1444 1445 1446 1447 1448 1449 1450 1451 |
# File 'rubyext.c', line 1443
VALUE
syck_scalar_initialize(VALUE self, VALUE type_id, VALUE val, VALUE 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;
}
|
Instance Method Details
#style= ⇒ Object
YAML::Syck::Scalar.style=
1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 |
# File 'rubyext.c', line 1456
VALUE
syck_scalar_style_set(VALUE self, VALUE 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= ⇒ Object
YAML::Syck::Scalar.value=
1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 |
# File 'rubyext.c', line 1494
VALUE
syck_scalar_value_set(VALUE self, VALUE val)
{
SyckNode *node;
Data_Get_Struct( self, SyckNode, node );
StringValue( val );
node->data.str->ptr = syck_strndup( RSTRING_PTR(val), RSTRING_LEN(val) );
node->data.str->len = RSTRING_LEN(val);
node->data.str->style = scalar_none;
rb_iv_set( self, "@value", val );
return val;
}
|