supplement 2.23 → 2.24

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/README +1 -1
  3. data/lib/supplement.c +10 -4
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3d7ee6d3e8eb25677cac8471ba79cbf665610dcb9b061b0e79e1ae138b64157
4
- data.tar.gz: 5f3753613e05e2878fa31aa81b8bb007e0fe399db578f1ece73ae76744abfba6
3
+ metadata.gz: 196a040bf5dba1ea9778b2a9c2335698e6d43214832a3106bb6efbb616d718ac
4
+ data.tar.gz: 41af129cdd0a520ee715b9663395c63e39754a8be3a494bb62d8e7a4d30cf8c0
5
5
  SHA512:
6
- metadata.gz: 28b038bda87536826cab7e3a9451ab73696e8958b687ef25b90a2c3b3a260464f58fecf1e39d9944b60aaa61c12363d3885ef12fe917ee611648418e8a102033
7
- data.tar.gz: b91a88ae34b04323ff296bc0c4fa303f729b053f0eb726ecd1d4fabc7c3d59c05dbda042567bfe3e0449d368dbaec80d676f8aaacd2b64b9b471a290a8158ddf
6
+ metadata.gz: fbf458038e5b477e340faf16ecbfa98058be9d2b3014253ce448666af627573c6b51eb9d4949fb0cf04af48b7bc42c15b304d39fa4ce3c2ceb0c0ac727a952b1
7
+ data.tar.gz: decd0d8dfa69fae98b8f03c4e19b06f9f28bf341d24bf38b83837ff8f955ec81a0b01904bd0c7bdee4077d7ec27c6c0f168997f861251f2c1aba0aca794aba50
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = supplement 2.23 -- Useful Ruby enhancements
1
+ = supplement 2.24 -- Useful Ruby enhancements
2
2
 
3
3
 
4
4
  Some simple Ruby extensions.
data/lib/supplement.c CHANGED
@@ -831,8 +831,11 @@ rb_ary_notempty_p( VALUE ary)
831
831
  VALUE
832
832
  rb_ary_first_set( VALUE ary, VALUE val)
833
833
  {
834
- rb_ary_modify(ary);
835
- RARRAY_ASET(ary, 0, val);
834
+ rb_ary_modify( ary);
835
+ long len = RARRAY_LEN( ary);
836
+ if (len == 0)
837
+ rb_raise( rb_eArgError, "cannot replace first element of an empty array");
838
+ RARRAY_ASET( ary, 0, val);
836
839
  return val;
837
840
  }
838
841
 
@@ -853,8 +856,11 @@ rb_ary_first_set( VALUE ary, VALUE val)
853
856
  VALUE
854
857
  rb_ary_last_set( VALUE ary, VALUE val)
855
858
  {
856
- rb_ary_modify(ary);
857
- RARRAY_ASET(ary, RARRAY_LEN(ary)-1, val);
859
+ rb_ary_modify( ary);
860
+ long len = RARRAY_LEN( ary);
861
+ if (len == 0)
862
+ rb_raise( rb_eArgError, "cannot replace last element of an empty array");
863
+ RARRAY_ASET( ary, len - 1, val);
858
864
  return val;
859
865
  }
860
866
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supplement
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.23'
4
+ version: '2.24'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf