Class: Cluster::Node
- Inherits:
-
Object
- Object
- Cluster::Node
- Defined in:
- lib/rbcluster/node.rb,
ext/rbcluster/rbcluster.c
Instance Attribute Summary collapse
Instance Method Summary collapse
- #initialize(*args) ⇒ Object constructor
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ Object
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 |
# File 'ext/rbcluster/rbcluster.c', line 519
VALUE rbcluster_node_initialize(int argc, VALUE* argv, VALUE self) {
VALUE left, right, distance;
rb_scan_args(argc, argv, "21", &left, &right, &distance);
if(NIL_P(distance)) {
distance = DBL2NUM(0.0);
}
rb_ivar_set(self, rb_intern("@left"), left);
rb_ivar_set(self, rb_intern("@right"), right);
rb_ivar_set(self, rb_intern("@distance"), distance);
return self;
}
|
Instance Attribute Details
#distance ⇒ Object
#left ⇒ Object
#right ⇒ Object
Instance Method Details
#to_s ⇒ Object
3 4 5 |
# File 'lib/rbcluster/node.rb', line 3 def to_s "(#{@left}, #{@right}): #{@distance}" end |