Class: Calc

Inherits:
Object
  • Object
show all
Defined in:
ext/ccalc/ccalc.c

Instance Method Summary collapse

Constructor Details

#initializeObject



3
4
5
6
7
8
# File 'ext/ccalc/ccalc.c', line 3

static VALUE t_init(VALUE self)
{
    VALUE arr = rb_ary_new();
    rb_iv_set(self, "@nums", arr);
    return self;
}

Instance Method Details

#get(obj) ⇒ Object



10
11
12
13
14
15
16
# File 'ext/ccalc/ccalc.c', line 10

static VALUE t_get(VALUE self, VALUE obj)
{
    VALUE arr;
    arr = rb_iv_get(self, "@nums");
    rb_funcall(arr, rb_intern("push"), 1, obj);
    return arr;
}

#minusObject



31
32
33
34
# File 'ext/ccalc/ccalc.c', line 31

static VALUE t_minus(VALUE self)
{
    return calculate(self, "-");
}

#plusObject



26
27
28
29
# File 'ext/ccalc/ccalc.c', line 26

static VALUE t_plus(VALUE self)
{
    return calculate(self, "+");
}