supplement 2.32 → 2.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/mkrf_conf +1 -1
- data/lib/supplement.c +38 -0
- data/lib/supplement.h +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a1c02a87bc3156c7468abf0618da0dc18769fc09335605638e62515ebfc4b3c
|
|
4
|
+
data.tar.gz: e73d0a28b4f10dafdaea31aa8aa55f85e29db0ecb5d392512ad0429a280a1e1d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca470be4d0d6f934d0adc74d249b52a1c682a38928848d03ea78ba3ef564cae49f2de61540b6e886fc8e08340085dacfd55d1516a9eab6bbc2c6dc3bfa227c79
|
|
7
|
+
data.tar.gz: 2c00ea6c30f2a6aa3b7f456d05c8f58895b12821590f928263e32e411d151ffe7e702b9b090cb954d677a628a5fc161217675b2a3496ae472230286300a3ca6a
|
data/README.md
CHANGED
data/lib/mkrf_conf
CHANGED
data/lib/supplement.c
CHANGED
|
@@ -552,6 +552,43 @@ rb_str_ends_with_p( int argc, VALUE *argv, VALUE str)
|
|
|
552
552
|
}
|
|
553
553
|
|
|
554
554
|
|
|
555
|
+
/*
|
|
556
|
+
* call-seq:
|
|
557
|
+
* notempy?( oth) -> nil or sym
|
|
558
|
+
*
|
|
559
|
+
* Checks whether the head is <code>oth</code>. Returns length of
|
|
560
|
+
* <code>oth</code> when matching.
|
|
561
|
+
*
|
|
562
|
+
* :"sys-apps".starts_with?( "sys-") #=> 4
|
|
563
|
+
*
|
|
564
|
+
* Caution! The Ruby 1.9.3 method #start_with? (note the missing s)
|
|
565
|
+
* just returns +true+ or +false+. Mnemonics: "s" = prepare for
|
|
566
|
+
* <code>#slice</code>.
|
|
567
|
+
*/
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
/*
|
|
571
|
+
* call-seq:
|
|
572
|
+
* notempty? -> nil or self
|
|
573
|
+
*
|
|
574
|
+
* Returns <code>self</code> if and only if <code>str</code> is not
|
|
575
|
+
* empty, <code>nil</code> otherwise.
|
|
576
|
+
*
|
|
577
|
+
* :hello.notempty? #=> :hello
|
|
578
|
+
* :"".notempty? #=> nil
|
|
579
|
+
*
|
|
580
|
+
* This seems to be quite useless. Its only purpose is to avoid either type
|
|
581
|
+
* detection or error catching if other objects are asked whether they're not
|
|
582
|
+
* empty.
|
|
583
|
+
*/
|
|
584
|
+
|
|
585
|
+
VALUE
|
|
586
|
+
rb_sym_notempty_p( VALUE sym)
|
|
587
|
+
{
|
|
588
|
+
return NUM2LONG( rb_funcall( sym, rb_intern( "length"), 0)) ? sym : Qnil;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
|
|
555
592
|
/*
|
|
556
593
|
* call-seq:
|
|
557
594
|
* starts_with?( oth) -> nil or int
|
|
@@ -1219,6 +1256,7 @@ void Init_supplement( void)
|
|
|
1219
1256
|
rb_define_method( rb_cString, "axe!", rb_str_axe_bang, -1);
|
|
1220
1257
|
rb_define_method( rb_cString, "starts_with?", rb_str_starts_with_p, -1);
|
|
1221
1258
|
rb_define_method( rb_cString, "ends_with?", rb_str_ends_with_p, -1);
|
|
1259
|
+
rb_define_method( rb_cSymbol, "notempty?", rb_sym_notempty_p, 0);
|
|
1222
1260
|
rb_define_method( rb_cSymbol, "starts_with?", rb_sym_starts_with_p, -1);
|
|
1223
1261
|
rb_define_method( rb_cSymbol, "ends_with?", rb_sym_ends_with_p, -1);
|
|
1224
1262
|
|
data/lib/supplement.h
CHANGED
|
@@ -29,6 +29,7 @@ extern VALUE rb_str_axe( int, VALUE *, VALUE);
|
|
|
29
29
|
extern VALUE rb_str_axe_bang( int, VALUE *, VALUE);
|
|
30
30
|
extern VALUE rb_str_starts_with_p( int argc, VALUE *argv, VALUE);
|
|
31
31
|
extern VALUE rb_str_ends_with_p( int argc, VALUE *argv, VALUE);
|
|
32
|
+
extern VALUE rb_sym_notempty_p( VALUE);
|
|
32
33
|
extern VALUE rb_sym_starts_with_p( int argc, VALUE *argv, VALUE);
|
|
33
34
|
extern VALUE rb_sym_ends_with_p( int argc, VALUE *argv, VALUE);
|
|
34
35
|
|