Class: Wiretap::NodeChildren
- Inherits:
-
Object
- Object
- Wiretap::NodeChildren
- Includes:
- Enumerable
- Defined in:
- lib/wiretap.rb,
ext/nodechildren.cpp
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #count ⇒ Object (also: #size, #length)
- #each ⇒ Object
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
248 249 250 |
# File 'lib/wiretap.rb', line 248 def node @node end |
Instance Method Details
#[](index) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'ext/nodechildren.cpp', line 16 static VALUE wiretap_node_children_get_at(VALUE self, VALUE index) { WireTapNodeHandle* node; Check_Type(index, T_FIXNUM); Data_Get_Struct(self, WireTapNodeHandle, node); WireTapNodeHandle child; RUN(node->getChild(FIX2INT(index), child)); return wiretap_node_create_with(child, rb_iv_get(self, "@server"), rb_iv_get(self, "@node")); } |
#count ⇒ Object Also known as: size, length
8 9 10 11 12 13 14 |
# File 'ext/nodechildren.cpp', line 8 static VALUE wiretap_node_children_count(VALUE self) { WireTapNodeHandle* node; int num; Data_Get_Struct(self, WireTapNodeHandle, node); RUN(node->getNumChildren(num)); return INT2FIX(num); } |
#each ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'ext/nodechildren.cpp', line 28 static VALUE wiretap_node_children_each(VALUE self) { WireTapNodeHandle* node; int i, num; Data_Get_Struct(self, WireTapNodeHandle, node); RUN(node->getNumChildren(num)); VALUE server = rb_iv_get(self, "@server"); VALUE parent = rb_iv_get(self, "@node"); for(i = 0; i < num; i++) { WireTapNodeHandle child; RUN(node->getChild(i, child)); rb_yield(wiretap_node_create_with(child, server, parent)); } return self; } |