supplement 2.17 → 2.19

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README +1 -1
  3. data/lib/supplement.c +32 -1
  4. data/lib/supplement.h +11 -8
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73e018e3f33dcfe0bea472488523a0afac6633396c4e8e76eab8afaef8a69402
4
- data.tar.gz: fc145b68d752ee76ceb9a2aa8c37af81039ccf29692bc574f8c6960c24c1f983
3
+ metadata.gz: 8f12d6981c0181c08be1fa99b15c330f37c62bffba70104e9995a928980e5976
4
+ data.tar.gz: 57eb53eaab47856e6d7209f1a4a236b3e4f0e4c8fd29c59f29b3ef126b0ecb1c
5
5
  SHA512:
6
- metadata.gz: 7af046c1e4311bcad5705cacfcd8404bc58162571bbb76f923d1abf0e0c4269a087018bf79174a46ffd02dea5c708f75b189e292799f0eda7467d0718d8bbeb3
7
- data.tar.gz: fc90b82a5585635d96fc4cd2f079082744b4bd925c033d2a5feb37a170b59c973f5a8be663fa64d1d61f19013e0afda36f8a0559683a55a2aecf6b0a80dc27e4
6
+ metadata.gz: 955e84edf5e769cf40dcf7cb476048cc8f3273b1cc32b1aa594b5b0992b3b2a3defcd272903fd09c47eb22cffa0a1037d9a8030657d62177ef21da13acf74c64
7
+ data.tar.gz: dd6313b98731e9129b63924867f880bd105b2a6f2e5879d6797dfded3fc262a78a8ee23f4c8efc0d2fb9462c926cf4effe6a7294dcd56d5001578a5e7a96a1ce
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = supplement 2.17 -- Useful Ruby enhancements
1
+ = supplement 2.19 -- Useful Ruby enhancements
2
2
 
3
3
 
4
4
  Some simple Ruby extensions.
data/lib/supplement.c CHANGED
@@ -1292,7 +1292,8 @@ supplement_do_unumask( VALUE v)
1292
1292
  VALUE
1293
1293
  rb_dir_s_current( VALUE dir)
1294
1294
  {
1295
- return rb_funcall( dir, rb_intern( "new"), 1, rb_str_new( ".", 1));
1295
+ VALUE dot = rb_str_new( ".", 1);
1296
+ return rb_funcall_passing_block( dir, rb_intern( "open"), 1, &dot);
1296
1297
  }
1297
1298
 
1298
1299
 
@@ -1511,6 +1512,32 @@ bsruby_set_thread_critical( VALUE c)
1511
1512
  */
1512
1513
 
1513
1514
 
1515
+
1516
+ /*
1517
+ * Document-class: Object
1518
+ */
1519
+
1520
+ /*
1521
+ * call-seq:
1522
+ * to_bool -> true
1523
+ *
1524
+ * Returns true for anything but +nil+ and +false+.
1525
+ */
1526
+
1527
+ VALUE
1528
+ rb_nil_to_bool( VALUE obj)
1529
+ {
1530
+ return Qfalse;
1531
+ }
1532
+
1533
+ VALUE
1534
+ rb_obj_to_bool( VALUE obj)
1535
+ {
1536
+ return Qtrue;
1537
+ }
1538
+
1539
+
1540
+
1514
1541
  void Init_supplement( void)
1515
1542
  {
1516
1543
  rb_define_method( rb_cObject, "new_string", rb_obj_new_string, 0);
@@ -1594,6 +1621,10 @@ void Init_supplement( void)
1594
1621
  rb_define_method( rb_cStruct, "fields", rb_struct_fields, -1);
1595
1622
  rb_define_alias( rb_cStruct, "fetch_values", "fields");
1596
1623
 
1624
+ rb_define_method( rb_cNilClass, "to_bool", rb_nil_to_bool, 0);
1625
+ rb_define_method( rb_cFalseClass, "to_bool", rb_nil_to_bool, 0);
1626
+ rb_define_method( rb_cObject, "to_bool", rb_obj_to_bool, 0);
1627
+
1597
1628
  id_delete_at = rb_intern( "delete_at");
1598
1629
  id_cmp = rb_intern( "<=>");
1599
1630
  id_eqq = 0;
data/lib/supplement.h CHANGED
@@ -45,6 +45,12 @@ extern VALUE rb_str_ord( VALUE);
45
45
  #endif
46
46
  extern VALUE rb_str_axe( int, VALUE *, VALUE);
47
47
 
48
+ extern VALUE rb_num_pos_p( VALUE);
49
+ extern VALUE rb_num_neg_p( VALUE);
50
+ extern VALUE rb_num_grammatical( VALUE, VALUE, VALUE);
51
+ extern VALUE rb_num_sqrt( VALUE);
52
+ extern VALUE rb_num_cbrt( VALUE);
53
+
48
54
  extern VALUE rb_ary_notempty_p( VALUE);
49
55
  extern VALUE rb_ary_indexes( VALUE);
50
56
  extern VALUE rb_ary_range( VALUE);
@@ -58,12 +64,6 @@ extern VALUE rb_ary_rindex( int, VALUE *, VALUE);
58
64
  extern VALUE rb_ary_select_bang( VALUE);
59
65
  #endif
60
66
 
61
- extern VALUE rb_num_pos_p( VALUE);
62
- extern VALUE rb_num_neg_p( VALUE);
63
- extern VALUE rb_num_grammatical( VALUE, VALUE, VALUE);
64
- extern VALUE rb_num_sqrt( VALUE);
65
- extern VALUE rb_num_cbrt( VALUE);
66
-
67
67
  extern VALUE rb_hash_notempty_p( VALUE);
68
68
 
69
69
  #ifdef FEATURE_FILE_SIZE
@@ -77,12 +77,15 @@ extern VALUE rb_dir_children( VALUE);
77
77
  extern VALUE rb_match_begin( int, VALUE *, VALUE);
78
78
  extern VALUE rb_match_end( int, VALUE *, VALUE);
79
79
 
80
- extern VALUE rb_struct_fields( int, VALUE *, VALUE);
81
-
82
80
  #ifdef FEATURE_THREAD_EXCLUSIVE
83
81
  extern VALUE rb_thread_exclusive( void);
84
82
  #endif
85
83
 
84
+ extern VALUE rb_struct_fields( int, VALUE *, VALUE);
85
+
86
+ extern VALUE rb_nil_to_bool( VALUE);
87
+ extern VALUE rb_obj_to_bool( VALUE);
88
+
86
89
  extern void Init_supplement( void);
87
90
 
88
91
  #endif
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supplement
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.17'
4
+ version: '2.19'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-12 00:00:00.000000000 Z
11
+ date: 2024-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autorake
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  requirements:
83
83
  - Ruby and the autorake gem
84
- rubygems_version: 3.4.20
84
+ rubygems_version: 3.5.6
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: Simple Ruby extensions