Class: Range

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#%(step) ⇒ Object

static VALUE step_each( VALUE self ) {

VALUE  a;
double beg, step;
size_t i, size;

a = cumo_na_step_parameters( self, Qnil );
beg  = NUM2DBL(RARRAY_PTR(a)[0]);
step = NUM2DBL(RARRAY_PTR(a)[1]);
size = NUM2SIZET(RARRAY_PTR(a)[2]);

for (i=0; i<size; i++) {
    rb_yield(rb_float_new(beg+i*step));
}
return self;

}



421
422
423
424
425
# File 'ext/cumo/narray/step.c', line 421

static VALUE
range_with_step( VALUE range, VALUE step )
{
    return cumo_na_step_new2( range, step, Qnil );
}

#*(len) ⇒ Object



427
428
429
430
431
# File 'ext/cumo/narray/step.c', line 427

static VALUE
range_with_length( VALUE range, VALUE len )
{
    return cumo_na_step_new2( range, Qnil, len );
}