cybrid_api_id_ruby 0.118.21 → 0.118.22

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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +5 -5
  4. data/cybrid_api_id_ruby.gemspec +1 -1
  5. data/lib/cybrid_api_id_ruby/api/bank_applications_idp_api.rb +1 -1
  6. data/lib/cybrid_api_id_ruby/api/customer_tokens_idp_api.rb +1 -1
  7. data/lib/cybrid_api_id_ruby/api/organization_applications_idp_api.rb +1 -1
  8. data/lib/cybrid_api_id_ruby/api/users_idp_api.rb +1 -1
  9. data/lib/cybrid_api_id_ruby/api_client.rb +1 -1
  10. data/lib/cybrid_api_id_ruby/api_error.rb +1 -1
  11. data/lib/cybrid_api_id_ruby/configuration.rb +1 -1
  12. data/lib/cybrid_api_id_ruby/models/application_idp_model.rb +1 -1
  13. data/lib/cybrid_api_id_ruby/models/application_list_idp_model.rb +1 -1
  14. data/lib/cybrid_api_id_ruby/models/application_with_secret_all_of_idp_model.rb +1 -1
  15. data/lib/cybrid_api_id_ruby/models/application_with_secret_idp_model.rb +1 -1
  16. data/lib/cybrid_api_id_ruby/models/customer_token_idp_model.rb +1 -1
  17. data/lib/cybrid_api_id_ruby/models/error_response_idp_model.rb +1 -1
  18. data/lib/cybrid_api_id_ruby/models/post_bank_application_idp_model.rb +1 -1
  19. data/lib/cybrid_api_id_ruby/models/post_customer_token_idp_model.rb +1 -1
  20. data/lib/cybrid_api_id_ruby/models/post_organization_application_idp_model.rb +1 -1
  21. data/lib/cybrid_api_id_ruby/models/post_user_idp_model.rb +1 -1
  22. data/lib/cybrid_api_id_ruby/models/user_idp_model.rb +1 -1
  23. data/lib/cybrid_api_id_ruby/models/user_list_idp_model.rb +1 -1
  24. data/lib/cybrid_api_id_ruby/version.rb +2 -2
  25. data/lib/cybrid_api_id_ruby.rb +1 -1
  26. data/spec/api/bank_applications_idp_api_spec.rb +1 -1
  27. data/spec/api/customer_tokens_idp_api_spec.rb +1 -1
  28. data/spec/api/organization_applications_idp_api_spec.rb +1 -1
  29. data/spec/api/users_idp_api_spec.rb +1 -1
  30. data/spec/api_client_spec.rb +1 -1
  31. data/spec/configuration_spec.rb +1 -1
  32. data/spec/models/application_idp_model_spec.rb +1 -1
  33. data/spec/models/application_list_idp_model_spec.rb +1 -1
  34. data/spec/models/application_with_secret_all_of_idp_model_spec.rb +1 -1
  35. data/spec/models/application_with_secret_idp_model_spec.rb +1 -1
  36. data/spec/models/customer_token_idp_model_spec.rb +1 -1
  37. data/spec/models/error_response_idp_model_spec.rb +1 -1
  38. data/spec/models/post_bank_application_idp_model_spec.rb +1 -1
  39. data/spec/models/post_customer_token_idp_model_spec.rb +1 -1
  40. data/spec/models/post_organization_application_idp_model_spec.rb +1 -1
  41. data/spec/models/post_user_idp_model_spec.rb +1 -1
  42. data/spec/models/user_idp_model_spec.rb +1 -1
  43. data/spec/models/user_list_idp_model_spec.rb +1 -1
  44. data/spec/spec_helper.rb +1 -1
  45. data/vendor/bundle/ruby/3.2.0/cache/stringio-3.1.1.gem +0 -0
  46. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
  47. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  48. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.2/gem_make.out +5 -5
  49. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.0/gem_make.out +5 -5
  50. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{stringio-3.1.0 → stringio-3.1.1}/gem_make.out +18 -18
  51. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.1/stringio.so +0 -0
  52. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/.document +5 -0
  53. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/.rdoc_options +2 -0
  54. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/COPYING +56 -0
  55. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/LICENSE.txt +22 -0
  56. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/NEWS.md +166 -0
  57. data/vendor/bundle/ruby/3.2.0/gems/{stringio-3.1.0 → stringio-3.1.1}/README.md +1 -1
  58. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/docs/io.rb +8 -0
  59. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/ext/stringio/.document +1 -0
  60. data/vendor/bundle/ruby/3.2.0/gems/{stringio-3.1.0 → stringio-3.1.1}/ext/stringio/stringio.c +114 -74
  61. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/lib/stringio.so +0 -0
  62. data/vendor/bundle/ruby/3.2.0/specifications/{stringio-3.1.0.gemspec → stringio-3.1.1.gemspec} +5 -4
  63. metadata +19 -12
  64. data/vendor/bundle/ruby/3.2.0/cache/stringio-3.1.0.gem +0 -0
  65. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/stringio.so +0 -0
  66. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.0/lib/stringio.so +0 -0
  67. /data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{stringio-3.1.0 → stringio-3.1.1}/gem.build_complete +0 -0
  68. /data/vendor/bundle/ruby/3.2.0/gems/{stringio-3.1.0 → stringio-3.1.1}/ext/stringio/Makefile +0 -0
  69. /data/vendor/bundle/ruby/3.2.0/gems/{stringio-3.1.0 → stringio-3.1.1}/ext/stringio/extconf.rb +0 -0
@@ -13,7 +13,9 @@
13
13
  **********************************************************************/
14
14
 
15
15
  static const char *const
16
- STRINGIO_VERSION = "3.1.0";
16
+ STRINGIO_VERSION = "3.1.1";
17
+
18
+ #include <stdbool.h>
17
19
 
18
20
  #include "ruby.h"
19
21
  #include "ruby/io.h"
@@ -48,7 +50,13 @@ static long strio_write(VALUE self, VALUE str);
48
50
 
49
51
  #define IS_STRIO(obj) (rb_typeddata_is_kind_of((obj), &strio_data_type))
50
52
  #define error_inval(msg) (rb_syserr_fail(EINVAL, msg))
51
- #define get_enc(ptr) ((ptr)->enc ? (ptr)->enc : rb_enc_get((ptr)->string))
53
+ #define get_enc(ptr) ((ptr)->enc ? (ptr)->enc : !NIL_P((ptr)->string) ? rb_enc_get((ptr)->string) : NULL)
54
+
55
+ static bool
56
+ readonly_string_p(VALUE string)
57
+ {
58
+ return OBJ_FROZEN_RAW(string);
59
+ }
52
60
 
53
61
  static struct StringIO *
54
62
  strio_alloc(void)
@@ -166,7 +174,10 @@ writable(VALUE strio)
166
174
  static void
167
175
  check_modifiable(struct StringIO *ptr)
168
176
  {
169
- if (OBJ_FROZEN(ptr->string)) {
177
+ if (NIL_P(ptr->string)) {
178
+ /* Null device StringIO */
179
+ }
180
+ else if (OBJ_FROZEN_RAW(ptr->string)) {
170
181
  rb_raise(rb_eIOError, "not modifiable string");
171
182
  }
172
183
  }
@@ -281,13 +292,14 @@ strio_init(int argc, VALUE *argv, struct StringIO *ptr, VALUE self)
281
292
 
282
293
  argc = rb_scan_args(argc, argv, "02:", &string, &vmode, &opt);
283
294
  rb_io_extract_modeenc(&vmode, 0, opt, &oflags, &ptr->flags, &convconfig);
284
- if (argc) {
295
+ if (!NIL_P(string)) {
285
296
  StringValue(string);
286
297
  }
287
- else {
298
+ else if (!argc) {
288
299
  string = rb_enc_str_new("", 0, rb_default_external_encoding());
289
300
  }
290
- if (OBJ_FROZEN_RAW(string)) {
301
+
302
+ if (!NIL_P(string) && readonly_string_p(string)) {
291
303
  if (ptr->flags & FMODE_WRITABLE) {
292
304
  rb_syserr_fail(EACCES, 0);
293
305
  }
@@ -297,11 +309,11 @@ strio_init(int argc, VALUE *argv, struct StringIO *ptr, VALUE self)
297
309
  ptr->flags |= FMODE_WRITABLE;
298
310
  }
299
311
  }
300
- if (ptr->flags & FMODE_TRUNC) {
312
+ if (!NIL_P(string) && (ptr->flags & FMODE_TRUNC)) {
301
313
  rb_str_resize(string, 0);
302
314
  }
303
315
  RB_OBJ_WRITE(self, &ptr->string, string);
304
- if (argc == 1) {
316
+ if (argc == 1 && !NIL_P(string)) {
305
317
  ptr->enc = rb_enc_get(string);
306
318
  }
307
319
  else {
@@ -481,7 +493,7 @@ strio_set_string(VALUE self, VALUE string)
481
493
  rb_io_taint_check(self);
482
494
  ptr->flags &= ~FMODE_READWRITE;
483
495
  StringValue(string);
484
- ptr->flags = OBJ_FROZEN(string) ? FMODE_READABLE : FMODE_READWRITE;
496
+ ptr->flags = readonly_string_p(string) ? FMODE_READABLE : FMODE_READWRITE;
485
497
  ptr->pos = 0;
486
498
  ptr->lineno = 0;
487
499
  RB_OBJ_WRITE(self, &ptr->string, string);
@@ -595,6 +607,7 @@ static struct StringIO *
595
607
  strio_to_read(VALUE self)
596
608
  {
597
609
  struct StringIO *ptr = readable(self);
610
+ if (NIL_P(ptr->string)) return NULL;
598
611
  if (ptr->pos < RSTRING_LEN(ptr->string)) return ptr;
599
612
  return NULL;
600
613
  }
@@ -872,7 +885,7 @@ strio_getc(VALUE self)
872
885
  int len;
873
886
  char *p;
874
887
 
875
- if (pos >= RSTRING_LEN(str)) {
888
+ if (NIL_P(str) || pos >= RSTRING_LEN(str)) {
876
889
  return Qnil;
877
890
  }
878
891
  p = RSTRING_PTR(str)+pos;
@@ -893,7 +906,7 @@ strio_getbyte(VALUE self)
893
906
  {
894
907
  struct StringIO *ptr = readable(self);
895
908
  int c;
896
- if (ptr->pos >= RSTRING_LEN(ptr->string)) {
909
+ if (NIL_P(ptr->string) || ptr->pos >= RSTRING_LEN(ptr->string)) {
897
910
  return Qnil;
898
911
  }
899
912
  c = RSTRING_PTR(ptr->string)[ptr->pos++];
@@ -915,9 +928,6 @@ strio_extend(struct StringIO *ptr, long pos, long len)
915
928
  if (pos > olen)
916
929
  MEMZERO(RSTRING_PTR(ptr->string) + olen, char, pos - olen);
917
930
  }
918
- else {
919
- rb_str_modify(ptr->string);
920
- }
921
931
  }
922
932
 
923
933
  /*
@@ -934,6 +944,7 @@ strio_ungetc(VALUE self, VALUE c)
934
944
  rb_encoding *enc, *enc2;
935
945
 
936
946
  check_modifiable(ptr);
947
+ if (NIL_P(ptr->string)) return Qnil;
937
948
  if (NIL_P(c)) return Qnil;
938
949
  if (RB_INTEGER_TYPE_P(c)) {
939
950
  int len, cc = NUM2INT(c);
@@ -971,12 +982,13 @@ strio_ungetbyte(VALUE self, VALUE c)
971
982
  struct StringIO *ptr = readable(self);
972
983
 
973
984
  check_modifiable(ptr);
985
+ if (NIL_P(ptr->string)) return Qnil;
974
986
  if (NIL_P(c)) return Qnil;
975
987
  if (RB_INTEGER_TYPE_P(c)) {
976
- /* rb_int_and() not visible from exts */
977
- VALUE v = rb_funcall(c, '&', 1, INT2FIX(0xff));
978
- const char cc = NUM2INT(v) & 0xFF;
979
- strio_unget_bytes(ptr, &cc, 1);
988
+ /* rb_int_and() not visible from exts */
989
+ VALUE v = rb_funcall(c, '&', 1, INT2FIX(0xff));
990
+ const char cc = NUM2INT(v) & 0xFF;
991
+ strio_unget_bytes(ptr, &cc, 1);
980
992
  }
981
993
  else {
982
994
  long cl;
@@ -1157,41 +1169,41 @@ prepare_getline_args(struct StringIO *ptr, struct getline_arg *arg, int argc, VA
1157
1169
  break;
1158
1170
 
1159
1171
  case 1:
1160
- if (!NIL_P(rs) && !RB_TYPE_P(rs, T_STRING)) {
1161
- VALUE tmp = rb_check_string_type(rs);
1172
+ if (!NIL_P(rs) && !RB_TYPE_P(rs, T_STRING)) {
1173
+ VALUE tmp = rb_check_string_type(rs);
1162
1174
  if (NIL_P(tmp)) {
1163
- limit = NUM2LONG(rs);
1164
- rs = rb_rs;
1175
+ limit = NUM2LONG(rs);
1176
+ rs = rb_rs;
1165
1177
  }
1166
1178
  else {
1167
- rs = tmp;
1179
+ rs = tmp;
1168
1180
  }
1169
1181
  }
1170
1182
  break;
1171
1183
 
1172
1184
  case 2:
1173
- if (!NIL_P(rs)) StringValue(rs);
1185
+ if (!NIL_P(rs)) StringValue(rs);
1174
1186
  if (!NIL_P(lim)) limit = NUM2LONG(lim);
1175
1187
  break;
1176
1188
  }
1177
- if (!NIL_P(rs)) {
1178
- rb_encoding *enc_rs, *enc_io;
1179
- enc_rs = rb_enc_get(rs);
1180
- enc_io = get_enc(ptr);
1181
- if (enc_rs != enc_io &&
1182
- (rb_enc_str_coderange(rs) != ENC_CODERANGE_7BIT ||
1183
- (RSTRING_LEN(rs) > 0 && !rb_enc_asciicompat(enc_io)))) {
1184
- if (rs == rb_rs) {
1185
- rs = rb_enc_str_new(0, 0, enc_io);
1186
- rb_str_buf_cat_ascii(rs, "\n");
1187
- rs = rs;
1188
- }
1189
- else {
1190
- rb_raise(rb_eArgError, "encoding mismatch: %s IO with %s RS",
1191
- rb_enc_name(enc_io),
1192
- rb_enc_name(enc_rs));
1193
- }
1194
- }
1189
+ if (!NIL_P(ptr->string) && !NIL_P(rs)) {
1190
+ rb_encoding *enc_rs, *enc_io;
1191
+ enc_rs = rb_enc_get(rs);
1192
+ enc_io = get_enc(ptr);
1193
+ if (enc_rs != enc_io &&
1194
+ (rb_enc_str_coderange(rs) != ENC_CODERANGE_7BIT ||
1195
+ (RSTRING_LEN(rs) > 0 && !rb_enc_asciicompat(enc_io)))) {
1196
+ if (rs == rb_rs) {
1197
+ rs = rb_enc_str_new(0, 0, enc_io);
1198
+ rb_str_buf_cat_ascii(rs, "\n");
1199
+ rs = rs;
1200
+ }
1201
+ else {
1202
+ rb_raise(rb_eArgError, "encoding mismatch: %s IO with %s RS",
1203
+ rb_enc_name(enc_io),
1204
+ rb_enc_name(enc_rs));
1205
+ }
1206
+ }
1195
1207
  }
1196
1208
  arg->rs = rs;
1197
1209
  arg->limit = limit;
@@ -1203,9 +1215,9 @@ prepare_getline_args(struct StringIO *ptr, struct getline_arg *arg, int argc, VA
1203
1215
  keywords[0] = rb_intern_const("chomp");
1204
1216
  }
1205
1217
  rb_get_kwargs(opts, keywords, 0, 1, &vchomp);
1206
- if (respect_chomp) {
1218
+ if (respect_chomp) {
1207
1219
  arg->chomp = (vchomp != Qundef) && RTEST(vchomp);
1208
- }
1220
+ }
1209
1221
  }
1210
1222
  return arg;
1211
1223
  }
@@ -1229,7 +1241,7 @@ strio_getline(struct getline_arg *arg, struct StringIO *ptr)
1229
1241
  long w = 0;
1230
1242
  rb_encoding *enc = get_enc(ptr);
1231
1243
 
1232
- if (ptr->pos >= (n = RSTRING_LEN(ptr->string))) {
1244
+ if (NIL_P(ptr->string) || ptr->pos >= (n = RSTRING_LEN(ptr->string))) {
1233
1245
  return Qnil;
1234
1246
  }
1235
1247
  s = RSTRING_PTR(ptr->string);
@@ -1245,7 +1257,7 @@ strio_getline(struct getline_arg *arg, struct StringIO *ptr)
1245
1257
  str = strio_substr(ptr, ptr->pos, e - s - w, enc);
1246
1258
  }
1247
1259
  else if ((n = RSTRING_LEN(str)) == 0) {
1248
- const char *paragraph_end = NULL;
1260
+ const char *paragraph_end = NULL;
1249
1261
  p = s;
1250
1262
  while (p[(p + 1 < e) && (*p == '\r') && 0] == '\n') {
1251
1263
  p += *p == '\r';
@@ -1255,18 +1267,18 @@ strio_getline(struct getline_arg *arg, struct StringIO *ptr)
1255
1267
  }
1256
1268
  s = p;
1257
1269
  while ((p = memchr(p, '\n', e - p)) && (p != e)) {
1258
- p++;
1259
- if (!((p < e && *p == '\n') ||
1260
- (p + 1 < e && *p == '\r' && *(p+1) == '\n'))) {
1261
- continue;
1262
- }
1263
- paragraph_end = p - ((*(p-2) == '\r') ? 2 : 1);
1264
- while ((p < e && *p == '\n') ||
1265
- (p + 1 < e && *p == '\r' && *(p+1) == '\n')) {
1266
- p += (*p == '\r') ? 2 : 1;
1267
- }
1268
- e = p;
1269
- break;
1270
+ p++;
1271
+ if (!((p < e && *p == '\n') ||
1272
+ (p + 1 < e && *p == '\r' && *(p+1) == '\n'))) {
1273
+ continue;
1274
+ }
1275
+ paragraph_end = p - ((*(p-2) == '\r') ? 2 : 1);
1276
+ while ((p < e && *p == '\n') ||
1277
+ (p + 1 < e && *p == '\r' && *(p+1) == '\n')) {
1278
+ p += (*p == '\r') ? 2 : 1;
1279
+ }
1280
+ e = p;
1281
+ break;
1270
1282
  }
1271
1283
  if (arg->chomp && paragraph_end) {
1272
1284
  w = e - paragraph_end;
@@ -1326,6 +1338,7 @@ strio_gets(int argc, VALUE *argv, VALUE self)
1326
1338
  VALUE str;
1327
1339
 
1328
1340
  if (prepare_getline_args(ptr, &arg, argc, argv)->limit == 0) {
1341
+ if (NIL_P(ptr->string)) return Qnil;
1329
1342
  return rb_enc_str_new(0, 0, get_enc(ptr));
1330
1343
  }
1331
1344
 
@@ -1440,6 +1453,7 @@ strio_write(VALUE self, VALUE str)
1440
1453
  if (!RB_TYPE_P(str, T_STRING))
1441
1454
  str = rb_obj_as_string(str);
1442
1455
  enc = get_enc(ptr);
1456
+ if (!enc) return 0;
1443
1457
  enc2 = rb_enc_get(str);
1444
1458
  if (enc != enc2 && enc != ascii8bit && enc != (usascii = rb_usascii_encoding())) {
1445
1459
  VALUE converted = rb_str_conv_enc(str, enc2, enc);
@@ -1465,6 +1479,7 @@ strio_write(VALUE self, VALUE str)
1465
1479
  }
1466
1480
  else {
1467
1481
  strio_extend(ptr, ptr->pos, len);
1482
+ rb_str_modify(ptr->string);
1468
1483
  memmove(RSTRING_PTR(ptr->string)+ptr->pos, RSTRING_PTR(str), len);
1469
1484
  }
1470
1485
  RB_GC_GUARD(str);
@@ -1511,10 +1526,12 @@ strio_putc(VALUE self, VALUE ch)
1511
1526
 
1512
1527
  check_modifiable(ptr);
1513
1528
  if (RB_TYPE_P(ch, T_STRING)) {
1529
+ if (NIL_P(ptr->string)) return ch;
1514
1530
  str = rb_str_substr(ch, 0, 1);
1515
1531
  }
1516
1532
  else {
1517
1533
  char c = NUM2CHR(ch);
1534
+ if (NIL_P(ptr->string)) return ch;
1518
1535
  str = rb_str_new(&c, 1);
1519
1536
  }
1520
1537
  strio_write(self, str);
@@ -1557,7 +1574,8 @@ strio_read(int argc, VALUE *argv, VALUE self)
1557
1574
  if (len < 0) {
1558
1575
  rb_raise(rb_eArgError, "negative length %ld given", len);
1559
1576
  }
1560
- if (len > 0 && ptr->pos >= RSTRING_LEN(ptr->string)) {
1577
+ if (len > 0 &&
1578
+ (NIL_P(ptr->string) || ptr->pos >= RSTRING_LEN(ptr->string))) {
1561
1579
  if (!NIL_P(str)) rb_str_resize(str, 0);
1562
1580
  return Qnil;
1563
1581
  }
@@ -1566,6 +1584,7 @@ strio_read(int argc, VALUE *argv, VALUE self)
1566
1584
  }
1567
1585
  /* fall through */
1568
1586
  case 0:
1587
+ if (NIL_P(ptr->string)) return Qnil;
1569
1588
  len = RSTRING_LEN(ptr->string);
1570
1589
  if (len <= ptr->pos) {
1571
1590
  rb_encoding *enc = get_enc(ptr);
@@ -1583,7 +1602,7 @@ strio_read(int argc, VALUE *argv, VALUE self)
1583
1602
  }
1584
1603
  break;
1585
1604
  default:
1586
- rb_error_arity(argc, 0, 2);
1605
+ rb_error_arity(argc, 0, 2);
1587
1606
  }
1588
1607
  if (NIL_P(str)) {
1589
1608
  rb_encoding *enc = binary ? rb_ascii8bit_encoding() : get_enc(ptr);
@@ -1594,10 +1613,9 @@ strio_read(int argc, VALUE *argv, VALUE self)
1594
1613
  if (len > rest) len = rest;
1595
1614
  rb_str_resize(str, len);
1596
1615
  MEMCPY(RSTRING_PTR(str), RSTRING_PTR(ptr->string) + ptr->pos, char, len);
1597
- if (binary)
1598
- rb_enc_associate(str, rb_ascii8bit_encoding());
1599
- else
1616
+ if (!binary) {
1600
1617
  rb_enc_copy(str, ptr->string);
1618
+ }
1601
1619
  }
1602
1620
  ptr->pos += RSTRING_LEN(str);
1603
1621
  return str;
@@ -1619,28 +1637,28 @@ strio_pread(int argc, VALUE *argv, VALUE self)
1619
1637
  long offset = NUM2LONG(rb_offset);
1620
1638
 
1621
1639
  if (len < 0) {
1622
- rb_raise(rb_eArgError, "negative string size (or size too big): %" PRIsVALUE, rb_len);
1640
+ rb_raise(rb_eArgError, "negative string size (or size too big): %" PRIsVALUE, rb_len);
1623
1641
  }
1624
1642
 
1625
1643
  if (len == 0) {
1626
- if (NIL_P(rb_buf)) {
1627
- return rb_str_new("", 0);
1628
- }
1629
- return rb_buf;
1644
+ if (NIL_P(rb_buf)) {
1645
+ return rb_str_new("", 0);
1646
+ }
1647
+ return rb_buf;
1630
1648
  }
1631
1649
 
1632
1650
  if (offset < 0) {
1633
- rb_syserr_fail_str(EINVAL, rb_sprintf("pread: Invalid offset argument: %" PRIsVALUE, rb_offset));
1651
+ rb_syserr_fail_str(EINVAL, rb_sprintf("pread: Invalid offset argument: %" PRIsVALUE, rb_offset));
1634
1652
  }
1635
1653
 
1636
1654
  struct StringIO *ptr = readable(self);
1637
1655
 
1638
1656
  if (offset >= RSTRING_LEN(ptr->string)) {
1639
- rb_eof_error();
1657
+ rb_eof_error();
1640
1658
  }
1641
1659
 
1642
1660
  if (NIL_P(rb_buf)) {
1643
- return strio_substr(ptr, offset, len, rb_ascii8bit_encoding());
1661
+ return strio_substr(ptr, offset, len, rb_ascii8bit_encoding());
1644
1662
  }
1645
1663
 
1646
1664
  long rest = RSTRING_LEN(ptr->string) - offset;
@@ -1700,8 +1718,14 @@ strio_read_nonblock(int argc, VALUE *argv, VALUE self)
1700
1718
  return val;
1701
1719
  }
1702
1720
 
1721
+ /*
1722
+ * See IO#write
1723
+ */
1703
1724
  #define strio_syswrite rb_io_write
1704
1725
 
1726
+ /*
1727
+ * See IO#write_nonblock
1728
+ */
1705
1729
  static VALUE
1706
1730
  strio_syswrite_nonblock(int argc, VALUE *argv, VALUE self)
1707
1731
  {
@@ -1729,7 +1753,7 @@ strio_size(VALUE self)
1729
1753
  {
1730
1754
  VALUE string = StringIO(self)->string;
1731
1755
  if (NIL_P(string)) {
1732
- rb_raise(rb_eIOError, "not opened");
1756
+ return INT2FIX(0);
1733
1757
  }
1734
1758
  return ULONG2NUM(RSTRING_LEN(string));
1735
1759
  }
@@ -1746,10 +1770,12 @@ strio_truncate(VALUE self, VALUE len)
1746
1770
  {
1747
1771
  VALUE string = writable(self)->string;
1748
1772
  long l = NUM2LONG(len);
1749
- long plen = RSTRING_LEN(string);
1773
+ long plen;
1750
1774
  if (l < 0) {
1751
1775
  error_inval("negative length");
1752
1776
  }
1777
+ if (NIL_P(string)) return 0;
1778
+ plen = RSTRING_LEN(string);
1753
1779
  rb_str_resize(string, l);
1754
1780
  if (plen < l) {
1755
1781
  MEMZERO(RSTRING_PTR(string) + plen, char, l - plen);
@@ -1820,13 +1846,22 @@ strio_set_encoding(int argc, VALUE *argv, VALUE self)
1820
1846
  }
1821
1847
  }
1822
1848
  ptr->enc = enc;
1823
- if (WRITABLE(self)) {
1849
+ if (!NIL_P(ptr->string) && WRITABLE(self)) {
1824
1850
  rb_enc_associate(ptr->string, enc);
1825
1851
  }
1826
1852
 
1827
1853
  return self;
1828
1854
  }
1829
1855
 
1856
+ /*
1857
+ * call-seq:
1858
+ * strio.set_encoding_by_bom => strio or nil
1859
+ *
1860
+ * Sets the encoding according to the BOM (Byte Order Mark) in the
1861
+ * string.
1862
+ *
1863
+ * Returns +self+ if the BOM is found, otherwise +nil.
1864
+ */
1830
1865
  static VALUE
1831
1866
  strio_set_encoding_by_bom(VALUE self)
1832
1867
  {
@@ -1859,10 +1894,15 @@ Init_stringio(void)
1859
1894
 
1860
1895
  VALUE StringIO = rb_define_class("StringIO", rb_cObject);
1861
1896
 
1897
+ /* The version string */
1862
1898
  rb_define_const(StringIO, "VERSION", rb_str_new_cstr(STRINGIO_VERSION));
1863
1899
 
1864
1900
  rb_include_module(StringIO, rb_mEnumerable);
1865
1901
  rb_define_alloc_func(StringIO, strio_s_allocate);
1902
+
1903
+ /* Maximum length that a StringIO instance can hold */
1904
+ rb_define_const(StringIO, "MAX_LENGTH", LONG2NUM(LONG_MAX));
1905
+
1866
1906
  rb_define_singleton_method(StringIO, "new", strio_s_new, -1);
1867
1907
  rb_define_singleton_method(StringIO, "open", strio_s_open, -1);
1868
1908
  rb_define_method(StringIO, "initialize", strio_initialize, -1);
@@ -1,19 +1,20 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: stringio 3.1.0 ruby lib
2
+ # stub: stringio 3.1.1 ruby lib
3
3
  # stub: ext/stringio/extconf.rb
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "stringio".freeze
7
- s.version = "3.1.0".freeze
7
+ s.version = "3.1.1".freeze
8
8
 
9
9
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
10
10
  s.require_paths = ["lib".freeze]
11
11
  s.authors = ["Nobu Nakada".freeze, "Charles Oliver Nutter".freeze]
12
- s.date = "2023-11-28"
12
+ s.date = "2024-06-13"
13
13
  s.description = "Pseudo `IO` class from/to `String`.".freeze
14
14
  s.email = ["nobu@ruby-lang.org".freeze, "headius@headius.com".freeze]
15
15
  s.extensions = ["ext/stringio/extconf.rb".freeze]
16
- s.files = ["ext/stringio/extconf.rb".freeze]
16
+ s.extra_rdoc_files = [".document".freeze, ".rdoc_options".freeze, "COPYING".freeze, "LICENSE.txt".freeze, "NEWS.md".freeze, "README.md".freeze, "docs/io.rb".freeze, "ext/stringio/.document".freeze]
17
+ s.files = [".document".freeze, ".rdoc_options".freeze, "COPYING".freeze, "LICENSE.txt".freeze, "NEWS.md".freeze, "README.md".freeze, "docs/io.rb".freeze, "ext/stringio/.document".freeze, "ext/stringio/extconf.rb".freeze]
17
18
  s.homepage = "https://github.com/ruby/stringio".freeze
18
19
  s.licenses = ["Ruby".freeze, "BSD-2-Clause".freeze]
19
20
  s.required_ruby_version = Gem::Requirement.new(">= 2.7".freeze)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cybrid_api_id_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.118.21
4
+ version: 0.118.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cybrid
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-12 00:00:00.000000000 Z
11
+ date: 2024-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -153,7 +153,7 @@ files:
153
153
  - vendor/bundle/ruby/3.2.0/cache/rspec-support-3.13.1.gem
154
154
  - vendor/bundle/ruby/3.2.0/cache/rubocop-0.66.0.gem
155
155
  - vendor/bundle/ruby/3.2.0/cache/ruby-progressbar-1.13.0.gem
156
- - vendor/bundle/ruby/3.2.0/cache/stringio-3.1.0.gem
156
+ - vendor/bundle/ruby/3.2.0/cache/stringio-3.1.1.gem
157
157
  - vendor/bundle/ruby/3.2.0/cache/typhoeus-1.4.1.gem
158
158
  - vendor/bundle/ruby/3.2.0/cache/unicode-display_width-1.5.0.gem
159
159
  - vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/byebug/byebug.so
@@ -169,9 +169,9 @@ files:
169
169
  - vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.0/gem.build_complete
170
170
  - vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.0/gem_make.out
171
171
  - vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.0/racc/cparse.so
172
- - vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem.build_complete
173
- - vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem_make.out
174
- - vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/stringio.so
172
+ - vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.1/gem.build_complete
173
+ - vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.1/gem_make.out
174
+ - vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.1/stringio.so
175
175
  - vendor/bundle/ruby/3.2.0/gems/ast-2.4.2/LICENSE.MIT
176
176
  - vendor/bundle/ruby/3.2.0/gems/ast-2.4.2/README.YARD.md
177
177
  - vendor/bundle/ruby/3.2.0/gems/ast-2.4.2/lib/ast.rb
@@ -2016,11 +2016,18 @@ files:
2016
2016
  - vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/time.rb
2017
2017
  - vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/timer.rb
2018
2018
  - vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/version.rb
2019
- - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.0/README.md
2020
- - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.0/ext/stringio/Makefile
2021
- - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.0/ext/stringio/extconf.rb
2022
- - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.0/ext/stringio/stringio.c
2023
- - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.0/lib/stringio.so
2019
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/.document
2020
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/.rdoc_options
2021
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/COPYING
2022
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/LICENSE.txt
2023
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/NEWS.md
2024
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/README.md
2025
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/docs/io.rb
2026
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/ext/stringio/.document
2027
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/ext/stringio/Makefile
2028
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/ext/stringio/extconf.rb
2029
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/ext/stringio/stringio.c
2030
+ - vendor/bundle/ruby/3.2.0/gems/stringio-3.1.1/lib/stringio.so
2024
2031
  - vendor/bundle/ruby/3.2.0/gems/typhoeus-1.4.1/.github/workflows/ci.yml
2025
2032
  - vendor/bundle/ruby/3.2.0/gems/typhoeus-1.4.1/.github/workflows/experimental.yml
2026
2033
  - vendor/bundle/ruby/3.2.0/gems/typhoeus-1.4.1/.gitignore
@@ -2150,7 +2157,7 @@ files:
2150
2157
  - vendor/bundle/ruby/3.2.0/specifications/rspec-support-3.13.1.gemspec
2151
2158
  - vendor/bundle/ruby/3.2.0/specifications/rubocop-0.66.0.gemspec
2152
2159
  - vendor/bundle/ruby/3.2.0/specifications/ruby-progressbar-1.13.0.gemspec
2153
- - vendor/bundle/ruby/3.2.0/specifications/stringio-3.1.0.gemspec
2160
+ - vendor/bundle/ruby/3.2.0/specifications/stringio-3.1.1.gemspec
2154
2161
  - vendor/bundle/ruby/3.2.0/specifications/typhoeus-1.4.1.gemspec
2155
2162
  - vendor/bundle/ruby/3.2.0/specifications/unicode-display_width-1.5.0.gemspec
2156
2163
  homepage: https://github.com/Cybrid-app/cybrid-api-id-ruby/