Class: Object::Syck::Seq
Instance Attribute Summary
Attributes inherited from Node
#emitter, #kind, #resolver, #type_id, #value
Instance Method Summary collapse
- #add(val) ⇒ Object
- #initialize(type_id, val, style) ⇒ Object constructor
- #style=(style) ⇒ Object
- #value=(val) ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(type_id, val, style) ⇒ Object
1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 |
# File 'ext/syck/rubyext.c', line 1711
VALUE
syck_seq_initialize(VALUE self, VALUE type_id, VALUE val, VALUE style)
{
SyckNode *node;
TypedData_Get_Struct( self, SyckNode, &syck_node_type, 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;
}
|
Instance Method Details
#add(val) ⇒ Object
1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 |
# File 'ext/syck/rubyext.c', line 1750
VALUE
syck_seq_add_m(VALUE self, VALUE val)
{
SyckNode *node;
VALUE emitter = rb_ivar_get( self, s_emitter );
TypedData_Get_Struct( self, SyckNode, &syck_node_type, 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=(style) ⇒ Object
1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 |
# File 'ext/syck/rubyext.c', line 1769
VALUE
syck_seq_style_set(VALUE self, VALUE style)
{
SyckNode *node;
TypedData_Get_Struct( self, SyckNode, &syck_node_type, 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=(val) ⇒ Object
1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 |
# File 'ext/syck/rubyext.c', line 1727
VALUE
syck_seq_value_set(VALUE self, VALUE val)
{
SyckNode *node;
TypedData_Get_Struct( self, SyckNode, &syck_node_type, 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;
}
|