mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
Array.last
This commit is contained in:
parent
76e2c26493
commit
403bb8aaee
1 changed files with 7 additions and 0 deletions
|
|
@ -9,6 +9,10 @@ static VALUE obj_clone(VALUE self){
|
|||
return rb_obj_clone(self);
|
||||
}
|
||||
|
||||
static VALUE a_last(VALUE self){
|
||||
return rb_ary_entry(self, -1);
|
||||
}
|
||||
|
||||
static VALUE int_times(VALUE self) {
|
||||
long n = NUM2LONG(self);
|
||||
|
||||
|
|
@ -50,4 +54,7 @@ void SunshineBindingInit(){
|
|||
if (!rb_respond_to(rb_cInteger, rb_intern("times"))) {
|
||||
rb_define_method(rb_cInteger, "times", RUBY_METHOD_FUNC(int_times), 0);
|
||||
}
|
||||
if (!rb_respond_to(rb_cArray, rb_intern("last"))) {
|
||||
rb_define_method(rb_cArray, "last", RUBY_METHOD_FUNC(a_last), 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue