Class: Object::Syck::Scalar
Instance Attribute Summary
Attributes inherited from Node
#emitter, #kind, #resolver, #type_id, #value
Instance Method Summary collapse
-
#initialize(type_id, val, style) ⇒ Object
constructor
YAML::Syck::Scalar.initialize.
-
#style=(style) ⇒ Object
YAML::Syck::Scalar.style=.
-
#value=(val) ⇒ Object
YAML::Syck::Scalar.value=.
Methods inherited from Node
Constructor Details
#initialize(type_id, val, style) ⇒ Object
YAML::Syck::Scalar.initialize
1616 1617 1618 1619 1620 1621 1622 1623 1624 |
# File 'ext/syck/rubyext.c', line 1616
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=(style) ⇒ Object
YAML::Syck::Scalar.style=
1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 |
# File 'ext/syck/rubyext.c', line 1629
VALUE
syck_scalar_style_set(VALUE self, VALUE style)
{
SyckNode *node;
TypedData_Get_Struct( self, SyckNode, &syck_node_type, 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=(val) ⇒ Object
YAML::Syck::Scalar.value=
1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 |
# File 'ext/syck/rubyext.c', line 1667
VALUE
syck_scalar_value_set(VALUE self, VALUE val)
{
SyckNode *node;
TypedData_Get_Struct( self, SyckNode, &syck_node_type, 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;
}
|