Class: Wiretap::NodeMetaData
- Inherits:
-
Object
- Object
- Wiretap::NodeMetaData
- Includes:
- Enumerable
- Defined in:
- lib/wiretap.rb,
ext/nodemetadata.cpp
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
-
#[](*args) ⇒ Object
Get metadata by index.
-
#[]=(index, value) ⇒ Object
Set metadata at index.
-
#count ⇒ Object
Get count of node metadata entries.
-
#each ⇒ Object
Run a block on each metadata entry - the metadata stream name and the content of the stream will be passed to the block.
-
#length ⇒ Object
Get count of node metadata entries.
- #streams ⇒ Object
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
274 275 276 |
# File 'lib/wiretap.rb', line 274 def node @node end |
Instance Method Details
#[](*args) ⇒ Object
Get metadata by index
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'ext/nodemetadata.cpp', line 18
static VALUE wiretap_node_metadata_get_at(int argc, VALUE *argv, VALUE self) {
WireTapNodeHandle* node;
VALUE stream_name, filter, depth;
rb_scan_args(argc, argv, "12", &stream_name, &filter, &depth);
Check_Type(stream_name, T_STRING);
if(filter != Qnil) {
Check_Type(filter, T_STRING);
}
if(depth != Qnil) {
Check_Type(depth, T_FIXNUM);
}
Data_Get_Struct(self, WireTapNodeHandle, node);
WireTapStr data;
NODERUN_E(node, node->getMetaData(CSTR(stream_name), filter == Qnil ? "all" : CSAFESTR(filter), depth == Qnil ? 0 : FIX2INT(depth), data));
return wiretap_to_str(data);
}
|
#[]=(index, value) ⇒ Object
Set metadata at index
42 43 44 45 46 47 48 49 50 |
# File 'ext/nodemetadata.cpp', line 42
static VALUE wiretap_node_metadata_set_at(VALUE self, VALUE index, VALUE value) {
WireTapNodeHandle* node;
Data_Get_Struct(self, WireTapNodeHandle, node);
Check_Type(index, T_STRING);
Check_Type(value, T_STRING);
NODERUN_E(node, node->setMetaData(CSTR(index), WireTapStr(CSTR(value))));
return self;
}
|
#count ⇒ Object
Get count of node metadata entries
7 8 9 10 11 12 13 |
# File 'ext/nodemetadata.cpp', line 7
static VALUE wiretap_node_metadata_count(VALUE self) {
WireTapNodeHandle* node;
int num;
Data_Get_Struct(self, WireTapNodeHandle, node);
NODERUN_E(node, node->getNumAvailableMetaDataStreams(num));
return INT2FIX(num);
}
|
#each ⇒ Object
Run a block on each metadata entry - the metadata stream name and the content of the stream will be passed to the block
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'ext/nodemetadata.cpp', line 55
static VALUE wiretap_node_metadata_each(VALUE self) {
WireTapNodeHandle* node;
int i, num;
Data_Get_Struct(self, WireTapNodeHandle, node);
NODERUN_E(node, node->getNumAvailableMetaDataStreams(num));
for(i = 0; i < num; i++) {
WireTapStr stream;
NODERUN_E(node, node->getAvailableMetaDataStream(i, stream));
WireTapStr data;
NODERUN_E(node, node->getMetaData(stream.c_str(), "all", -1, data));
rb_yield(rb_ary_new3(2, wiretap_to_str(stream), wiretap_to_str(data)));
}
return self;
}
|
#length ⇒ Object
Get count of node metadata entries
7 8 9 10 11 12 13 |
# File 'ext/nodemetadata.cpp', line 7
static VALUE wiretap_node_metadata_count(VALUE self) {
WireTapNodeHandle* node;
int num;
Data_Get_Struct(self, WireTapNodeHandle, node);
NODERUN_E(node, node->getNumAvailableMetaDataStreams(num));
return INT2FIX(num);
}
|
#streams ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'ext/nodemetadata.cpp', line 72
static VALUE wiretap_node_metadata_stream_names(VALUE self) {
VALUE stream_names = rb_ary_new();
int i, num;
WireTapNodeHandle* node;
Data_Get_Struct(self, WireTapNodeHandle, node);
NODERUN_E(node, node->getNumAvailableMetaDataStreams(num));
for(i = 0; i < num; i++) {
WireTapStr stream;
NODERUN_E(node, node->getAvailableMetaDataStream(i, stream));
rb_ary_push(stream_names, wiretap_to_str(stream));
}
return stream_names;
}
|