ruby-paseto 0.1.2 → 0.2.0

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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +55 -50
  4. data/lib/paseto/asn1/ecdsa_signature.rb +2 -2
  5. data/lib/paseto/asymmetric_key.rb +7 -4
  6. data/lib/paseto/configuration/decode_configuration.rb +7 -7
  7. data/lib/paseto/interface/key.rb +5 -2
  8. data/lib/paseto/interface/pbkd.rb +4 -20
  9. data/lib/paseto/interface/pie.rb +5 -26
  10. data/lib/paseto/interface/pke.rb +15 -51
  11. data/lib/paseto/interface/version.rb +30 -117
  12. data/lib/paseto/operations/id/i_dv3.rb +1 -1
  13. data/lib/paseto/operations/id/i_dv4.rb +1 -1
  14. data/lib/paseto/operations/pbkd/p_b_k_dv3.rb +4 -5
  15. data/lib/paseto/operations/pbkd/p_b_k_dv4.rb +3 -4
  16. data/lib/paseto/operations/pbkw.rb +6 -6
  17. data/lib/paseto/operations/pke/p_k_ev3.rb +23 -25
  18. data/lib/paseto/operations/pke/p_k_ev4.rb +33 -34
  19. data/lib/paseto/operations/pke.rb +9 -10
  20. data/lib/paseto/operations/wrap.rb +1 -1
  21. data/lib/paseto/paserk.rb +1 -1
  22. data/lib/paseto/paserk_types.rb +2 -2
  23. data/lib/paseto/protocol/version3.rb +17 -16
  24. data/lib/paseto/protocol/version4.rb +17 -16
  25. data/lib/paseto/symmetric_key.rb +16 -10
  26. data/lib/paseto/token.rb +17 -15
  27. data/lib/paseto/token_types.rb +2 -2
  28. data/lib/paseto/util.rb +1 -1
  29. data/lib/paseto/v3/local.rb +1 -1
  30. data/lib/paseto/v3/public.rb +5 -4
  31. data/lib/paseto/v4/local.rb +3 -3
  32. data/lib/paseto/v4/public.rb +3 -6
  33. data/lib/paseto/validator.rb +1 -1
  34. data/lib/paseto/version.rb +1 -1
  35. data/lib/paseto/versions.rb +2 -2
  36. data/lib/paseto/wrappers/pie/pie_v3.rb +18 -21
  37. data/lib/paseto/wrappers/pie/pie_v4.rb +17 -20
  38. data/lib/paseto/wrappers/pie.rb +3 -17
  39. data/lib/paseto.rb +2 -5
  40. data/paseto.gemspec +5 -5
  41. data/sorbet/rbi/annotations/.gitattributes +1 -0
  42. data/sorbet/rbi/annotations/rainbow.rbi +4 -4
  43. data/sorbet/rbi/gems/.gitattributes +1 -0
  44. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1 -1
  45. data/sorbet/rbi/gems/docile@1.4.0.rbi +1 -1
  46. data/sorbet/rbi/gems/{ffi@1.15.5.rbi → ffi@1.16.3.rbi} +260 -117
  47. data/sorbet/rbi/gems/{oj@3.14.2.rbi → oj@3.16.1.rbi} +26 -37
  48. data/sorbet/rbi/gems/{rake@13.0.6.rbi → rake@13.1.0.rbi} +75 -69
  49. data/sorbet/rbi/gems/rbnacl@7.1.1.rbi +2 -2
  50. data/sorbet/rbi/gems/{rspec-core@3.12.1.rbi → rspec-core@3.12.2.rbi} +1 -1
  51. data/sorbet/rbi/gems/{rspec-expectations@3.12.2.rbi → rspec-expectations@3.12.3.rbi} +27 -33
  52. data/sorbet/rbi/gems/{rspec-mocks@3.12.4.rbi → rspec-mocks@3.12.6.rbi} +60 -61
  53. data/sorbet/rbi/gems/{rspec-support@3.12.0.rbi → rspec-support@3.12.1.rbi} +35 -43
  54. data/sorbet/rbi/gems/rspec@3.12.0.rbi +22 -28
  55. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +41 -44
  56. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +232 -2
  57. data/sorbet/rbi/gems/{timecop@0.9.6.rbi → timecop@0.9.8.rbi} +13 -16
  58. data/sorbet/rbi/shims/multi_json.rbi +2 -0
  59. data/sorbet/rbi/shims/openssl.rbi +0 -8
  60. data/sorbet/rbi/todo.rbi +5 -1
  61. metadata +19 -42
  62. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -584
  63. data/sorbet/rbi/gems/io-console@0.6.0.rbi +0 -8
  64. data/sorbet/rbi/gems/irb@1.6.3.rbi +0 -342
  65. data/sorbet/rbi/gems/json@2.6.3.rbi +0 -1541
  66. data/sorbet/rbi/gems/multi_json@1.15.0.rbi +0 -267
  67. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -158
  68. data/sorbet/rbi/gems/openssl@3.1.0.rbi +0 -1739
  69. data/sorbet/rbi/gems/parallel@1.22.1.rbi +0 -277
  70. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -407
  71. data/sorbet/rbi/gems/regexp_parser@2.7.0.rbi +0 -3580
  72. data/sorbet/rbi/gems/reline@0.3.2.rbi +0 -8
  73. data/sorbet/rbi/gems/rexml@3.2.5.rbi +0 -4717
  74. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +0 -1317
  75. data/sorbet/rbi/gems/thor@1.2.1.rbi +0 -3956
  76. data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +0 -65
  77. data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -2555
  78. data/sorbet/rbi/gems/yard-sorbet@0.8.0.rbi +0 -441
  79. data/sorbet/rbi/gems/yard@0.9.28.rbi +0 -17816
  80. data/sorbet/rbi/gems/zeitwerk@2.6.7.rbi +0 -8
@@ -4,16 +4,22 @@
4
4
  # This is an autogenerated file for types exported from the `ffi` gem.
5
5
  # Please instead update this file by running `bin/tapioca gem ffi`.
6
6
 
7
- # source://ffi//lib/ffi/platform.rb#32
7
+ # source://ffi//lib/ffi/compat.rb#32
8
8
  module FFI
9
+ private
10
+
11
+ def custom_typedefs; end
12
+
9
13
  class << self
10
14
  # Add a definition type to type definitions.
11
15
  #
16
+ # The type definition is local per Ractor.
17
+ #
12
18
  # @param old [Type, DataConverter, Symbol] type definition used by {FFI.find_type}
13
19
  # @param add [Symbol] new type definition's name to add
14
20
  # @return [Type]
15
21
  #
16
- # source://ffi//lib/ffi/types.rb#45
22
+ # source://ffi//lib/ffi/types.rb#57
17
23
  def add_typedef(old, add); end
18
24
 
19
25
  # @see FFI::LastError.error
@@ -34,9 +40,14 @@ module FFI
34
40
  # @param type_map [Hash] if nil, {FFI::TypeDefs} is used
35
41
  # @return [Type]
36
42
  #
37
- # source://ffi//lib/ffi/types.rb#56
43
+ # source://ffi//lib/ffi/types.rb#76
38
44
  def find_type(name, type_map = T.unsafe(nil)); end
39
45
 
46
+ # This is for FFI internal use only.
47
+ #
48
+ # source://ffi//lib/ffi/compat.rb#35
49
+ def make_shareable(obj); end
50
+
40
51
  # Transform a generic library name to a platform library name
41
52
  #
42
53
  # @example
@@ -46,10 +57,10 @@ module FFI
46
57
  # # Windows
47
58
  # FFI.map_library_name 'c' # -> "msvcrt.dll"
48
59
  # FFI.map_library_name 'jpeg' # -> "jpeg.dll"
49
- # @param lib [#to_s] library name
60
+ # @param lib [String, FFI::LibraryPath] library name or LibraryPath object
50
61
  # @return [String] library name formatted for current platform
51
62
  #
52
- # source://ffi//lib/ffi/library.rb#44
63
+ # source://ffi//lib/ffi/library.rb#46
53
64
  def map_library_name(lib); end
54
65
 
55
66
  # Get +type+ size, in bytes.
@@ -57,17 +68,28 @@ module FFI
57
68
  # @param type +type+ is an instance of class accepted by {FFI.find_type}
58
69
  # @return [Numeric]
59
70
  #
60
- # source://ffi//lib/ffi/types.rb#176
71
+ # source://ffi//lib/ffi/types.rb#200
61
72
  def type_size(type); end
62
73
 
63
74
  # Add a definition type to type definitions.
64
75
  #
76
+ # The type definition is local per Ractor.
77
+ #
65
78
  # @param old [Type, DataConverter, Symbol] type definition used by {FFI.find_type}
66
79
  # @param add [Symbol] new type definition's name to add
67
80
  # @return [Type]
68
81
  #
69
- # source://ffi//lib/ffi/types.rb#40
82
+ # source://ffi//lib/ffi/types.rb#51
70
83
  def typedef(old, add); end
84
+
85
+ private
86
+
87
+ # source://ffi//lib/ffi/types.rb#62
88
+ def __typedef(old, add); end
89
+
90
+ # Truffleruby and JRuby don't support Ractor so far.
91
+ # So they don't need separation between builtin and custom types.
92
+ def custom_typedefs; end
71
93
  end
72
94
  end
73
95
 
@@ -76,6 +98,7 @@ class FFI::AbstractMemory
76
98
  def [](_arg0); end
77
99
  def __copy_from__(_arg0, _arg1); end
78
100
  def clear; end
101
+ def freeze; end
79
102
  def get(_arg0, _arg1); end
80
103
  def get_array_of_char(_arg0, _arg1); end
81
104
  def get_array_of_double(_arg0, _arg1); end
@@ -316,6 +339,7 @@ class FFI::AutoPointer < ::FFI::Pointer
316
339
  # Set +autorelease+ property. See {Pointer Autorelease section at Pointer}.
317
340
  #
318
341
  # @param autorelease [Boolean]
342
+ # @raise [FrozenError]
319
343
  # @return [Boolean] +autorelease+
320
344
  #
321
345
  # source://ffi//lib/ffi/autopointer.rb#109
@@ -325,7 +349,7 @@ class FFI::AutoPointer < ::FFI::Pointer
325
349
  #
326
350
  # @return [Boolean] +autorelease+
327
351
  #
328
- # source://ffi//lib/ffi/autopointer.rb#115
352
+ # source://ffi//lib/ffi/autopointer.rb#116
329
353
  def autorelease?; end
330
354
 
331
355
  # Free the pointer.
@@ -343,7 +367,7 @@ class FFI::AutoPointer < ::FFI::Pointer
343
367
  # @overload self.from_native
344
368
  # @return [AutoPointer]
345
369
  #
346
- # source://ffi//lib/ffi/autopointer.rb#198
370
+ # source://ffi//lib/ffi/autopointer.rb#183
347
371
  def from_native(val, ctx); end
348
372
 
349
373
  # Return native type of AutoPointer.
@@ -353,48 +377,18 @@ class FFI::AutoPointer < ::FFI::Pointer
353
377
  # @raise [RuntimeError] if class does not implement a +#release+ method
354
378
  # @return [Type::POINTER]
355
379
  #
356
- # source://ffi//lib/ffi/autopointer.rb#184
380
+ # source://ffi//lib/ffi/autopointer.rb#169
357
381
  def native_type; end
358
382
  end
359
383
  end
360
384
 
361
- # CallableReleaser is a {Releaser} used when an {AutoPointer} is defined with a
362
- # Proc or a Method.
363
- #
364
- # source://ffi//lib/ffi/autopointer.rb#173
365
- class FFI::AutoPointer::CallableReleaser < ::FFI::AutoPointer::Releaser
366
- # Release +ptr+ by using Proc or Method defined at +ptr+
367
- # {AutoPointer#initialize initialization}.
368
- #
369
- # @param ptr [Pointer]
370
- # @return [nil]
371
- #
372
- # source://ffi//lib/ffi/autopointer.rb#174
373
- def release(ptr); end
374
- end
375
-
376
- # DefaultReleaser is a {Releaser} used when an {AutoPointer} is defined
377
- # without Proc or Method. In this case, the pointer to release must be of
378
- # a class derived from AutoPointer with a {release} class method.
379
- #
380
- # source://ffi//lib/ffi/autopointer.rb#160
381
- class FFI::AutoPointer::DefaultReleaser < ::FFI::AutoPointer::Releaser
382
- # Release +ptr+ using the {release} class method of its class.
383
- #
384
- # @param ptr [Pointer]
385
- # @return [nil]
386
- #
387
- # source://ffi//lib/ffi/autopointer.rb#161
388
- def release(ptr); end
389
- end
390
-
391
385
  # A releaser is an object in charge of release an {AutoPointer}.
392
386
  #
393
387
  # @abstract Base class for {AutoPointer}'s releasers.
394
388
  #
395
389
  # All subclasses of Releaser should define a +#release(ptr)+ method.
396
390
  #
397
- # source://ffi//lib/ffi/autopointer.rb#123
391
+ # source://ffi//lib/ffi/autopointer.rb#124
398
392
  class FFI::AutoPointer::Releaser
399
393
  # A new instance of Releaser.
400
394
  #
@@ -402,34 +396,43 @@ class FFI::AutoPointer::Releaser
402
396
  # @param proc [#call]
403
397
  # @return [nil]
404
398
  #
405
- # source://ffi//lib/ffi/autopointer.rb#130
399
+ # source://ffi//lib/ffi/autopointer.rb#131
406
400
  def initialize(ptr, proc); end
407
401
 
408
402
  # Returns the value of attribute autorelease.
409
403
  #
410
- # source://ffi//lib/ffi/autopointer.rb#124
404
+ # source://ffi//lib/ffi/autopointer.rb#125
411
405
  def autorelease; end
412
406
 
413
407
  # Sets the attribute autorelease
414
408
  #
415
409
  # @param value the value to set the attribute autorelease to.
416
410
  #
417
- # source://ffi//lib/ffi/autopointer.rb#124
411
+ # source://ffi//lib/ffi/autopointer.rb#125
418
412
  def autorelease=(_arg0); end
419
413
 
420
414
  # Release pointer if +autorelease+ is set.
421
415
  #
422
416
  # @param args
423
417
  #
424
- # source://ffi//lib/ffi/autopointer.rb#149
418
+ # source://ffi//lib/ffi/autopointer.rb#150
425
419
  def call(*args); end
426
420
 
427
421
  # Free pointer.
428
422
  #
429
423
  # @return [nil]
430
424
  #
431
- # source://ffi//lib/ffi/autopointer.rb#138
425
+ # source://ffi//lib/ffi/autopointer.rb#139
432
426
  def free; end
427
+
428
+ # Release +ptr+ by using Proc or Method defined at +ptr+
429
+ # {AutoPointer#initialize initialization}.
430
+ #
431
+ # @param ptr [Pointer]
432
+ # @return [nil]
433
+ #
434
+ # source://ffi//lib/ffi/autopointer.rb#159
435
+ def release(ptr); end
433
436
  end
434
437
 
435
438
  # Represents a C enum whose values are power of 2
@@ -461,14 +464,14 @@ class FFI::Bitmask < ::FFI::Enum
461
464
  # @overload []
462
465
  # @raise [ArgumentError]
463
466
  #
464
- # source://ffi//lib/ffi/enum.rb#236
467
+ # source://ffi//lib/ffi/enum.rb#237
465
468
  def [](*query); end
466
469
 
467
470
  # @param val [Integer]
468
471
  # @param ctx unused
469
472
  # @return [Array<Symbol, Integer>] list of symbol names corresponding to val, plus an optional remainder if some bits don't match any constant
470
473
  #
471
- # source://ffi//lib/ffi/enum.rb#282
474
+ # source://ffi//lib/ffi/enum.rb#289
472
475
  def from_native(val, ctx); end
473
476
 
474
477
  # Get the native value of a bitmask
@@ -476,7 +479,7 @@ class FFI::Bitmask < ::FFI::Enum
476
479
  # @overload to_native
477
480
  # @overload to_native
478
481
  #
479
- # source://ffi//lib/ffi/enum.rb#260
482
+ # source://ffi//lib/ffi/enum.rb#261
480
483
  def to_native(query, ctx); end
481
484
  end
482
485
 
@@ -503,14 +506,14 @@ class FFI::Buffer < ::FFI::AbstractMemory
503
506
  end
504
507
  end
505
508
 
506
- # source://ffi//lib/ffi/library.rb#32
509
+ # source://ffi//lib/ffi/library.rb#34
507
510
  FFI::CURRENT_PROCESS = T.let(T.unsafe(nil), Object)
508
511
 
509
512
  FFI::CallbackInfo = FFI::FunctionType
510
513
 
511
514
  # This module is used to extend somes classes and give then a common API.
512
515
  #
513
- # Most of methods defined here must be overriden.
516
+ # Most of methods defined here must be overridden.
514
517
  #
515
518
  # source://ffi//lib/ffi/data_converter.rb#35
516
519
  module FFI::DataConverter
@@ -533,6 +536,7 @@ module FFI::DataConverter
533
536
  def to_native(value, ctx); end
534
537
  end
535
538
 
539
+ # source://ffi//lib/ffi/dynamic_library.rb#32
536
540
  class FFI::DynamicLibrary
537
541
  def initialize(_arg0, _arg1); end
538
542
 
@@ -545,6 +549,14 @@ class FFI::DynamicLibrary
545
549
  class << self
546
550
  def last_error; end
547
551
  def open(_arg0, _arg1); end
552
+
553
+ private
554
+
555
+ # source://ffi//lib/ffi/dynamic_library.rb#40
556
+ def load_library(name, flags); end
557
+
558
+ # source://ffi//lib/ffi/dynamic_library.rb#70
559
+ def try_load(libname, flags, errors); end
548
560
  end
549
561
  end
550
562
 
@@ -561,6 +573,12 @@ FFI::DynamicLibrary::RTLD_NODELETE = T.let(T.unsafe(nil), Integer)
561
573
  FFI::DynamicLibrary::RTLD_NOLOAD = T.let(T.unsafe(nil), Integer)
562
574
  FFI::DynamicLibrary::RTLD_NOW = T.let(T.unsafe(nil), Integer)
563
575
 
576
+ # source://ffi//lib/ffi/dynamic_library.rb#33
577
+ FFI::DynamicLibrary::SEARCH_PATH = T.let(T.unsafe(nil), Array)
578
+
579
+ # source://ffi//lib/ffi/dynamic_library.rb#38
580
+ FFI::DynamicLibrary::SEARCH_PATH_MESSAGE = T.let(T.unsafe(nil), String)
581
+
564
582
  class FFI::DynamicLibrary::Symbol < ::FFI::Pointer
565
583
  def inspect; end
566
584
 
@@ -690,19 +708,52 @@ class FFI::Enums
690
708
  def find(query); end
691
709
  end
692
710
 
711
+ # source://ffi//lib/ffi/function.rb#32
693
712
  class FFI::Function < ::FFI::Pointer
713
+ include ::FFI::Function::RegisterAttach
714
+
694
715
  def initialize(*_arg0); end
695
716
 
696
- def attach(_arg0, _arg1); end
717
+ # source://ffi//lib/ffi/function.rb#57
718
+ def attach(mod, name); end
719
+
697
720
  def autorelease; end
698
721
  def autorelease=(_arg0); end
699
722
  def autorelease?; end
700
723
  def call(*_arg0); end
701
724
  def free; end
702
725
 
726
+ # Retrieve Array of parameter types
727
+ #
728
+ # This method returns an Array of FFI types accepted as function parameters.
729
+ #
730
+ # @return [Array<FFI::Type>]
731
+ #
732
+ # source://ffi//lib/ffi/function.rb#49
733
+ def param_types; end
734
+
735
+ # Retrieve the return type of the function
736
+ #
737
+ # This method returns FFI type returned by the function.
738
+ #
739
+ # @return [FFI::Type]
740
+ #
741
+ # source://ffi//lib/ffi/function.rb#40
742
+ def return_type; end
743
+
703
744
  private
704
745
 
705
746
  def initialize_copy(_arg0); end
747
+ def type; end
748
+ end
749
+
750
+ # Stash the Function in a module variable so it can be inspected by attached_functions.
751
+ # On CRuby it also ensures that it does not get garbage collected.
752
+ #
753
+ # source://ffi//lib/ffi/function.rb#56
754
+ module FFI::Function::RegisterAttach
755
+ # source://ffi//lib/ffi/function.rb#57
756
+ def attach(mod, name); end
706
757
  end
707
758
 
708
759
  FFI::FunctionInfo = FFI::FunctionType
@@ -711,7 +762,7 @@ class FFI::FunctionType < ::FFI::Type
711
762
  def initialize(*_arg0); end
712
763
 
713
764
  def param_types; end
714
- def result_type; end
765
+ def return_type; end
715
766
  end
716
767
 
717
768
  # This module implements a couple of class methods to play with IO.
@@ -768,7 +819,7 @@ end
768
819
  #
769
820
  # Hello.puts("Hello, World")
770
821
  #
771
- # source://ffi//lib/ffi/library.rb#78
822
+ # source://ffi//lib/ffi/library.rb#72
772
823
  module FFI::Library
773
824
  # Attach C function +func+ to this module.
774
825
  #
@@ -786,7 +837,7 @@ module FFI::Library
786
837
  # @raise [FFI::NotFoundError] if +func+ cannot be found in the attached libraries (see {#ffi_lib})
787
838
  # @return [FFI::VariadicInvoker]
788
839
  #
789
- # source://ffi//lib/ffi/library.rb#234
840
+ # source://ffi//lib/ffi/library.rb#177
790
841
  def attach_function(name, func, args, returns = T.unsafe(nil), options = T.unsafe(nil)); end
791
842
 
792
843
  # Attach C variable +cname+ to this module.
@@ -796,9 +847,28 @@ module FFI::Library
796
847
  # @raise [FFI::NotFoundError] if +cname+ cannot be found in libraries
797
848
  # @return [DynamicLibrary::Symbol]
798
849
  #
799
- # source://ffi//lib/ffi/library.rb#331
850
+ # source://ffi//lib/ffi/library.rb#274
800
851
  def attach_variable(mname, a1, a2 = T.unsafe(nil)); end
801
852
 
853
+ # Retrieve all attached functions and their function signature
854
+ #
855
+ # This method returns a Hash of method names of attached functions connected by #attach_function and the corresponding function type.
856
+ # The function type responds to #return_type and #param_types which return the FFI types of the function signature.
857
+ #
858
+ # @return [Hash< Symbol => [FFI::Function, FFI::VariadicInvoker] >]
859
+ #
860
+ # source://ffi//lib/ffi/library.rb#544
861
+ def attached_functions; end
862
+
863
+ # Retrieve all attached variables and their type
864
+ #
865
+ # This method returns a Hash of variable names and the corresponding type or variables connected by #attach_variable .
866
+ #
867
+ # @return [Hash< Symbol => ffi_type >]
868
+ #
869
+ # source://ffi//lib/ffi/library.rb#553
870
+ def attached_variables; end
871
+
802
872
  # Create a new FFI::Bitmask
803
873
  #
804
874
  # @overload bitmask
@@ -809,7 +879,7 @@ module FFI::Library
809
879
  # @overload bitmask
810
880
  # @return [FFI::Bitmask]
811
881
  #
812
- # source://ffi//lib/ffi/library.rb#554
882
+ # source://ffi//lib/ffi/library.rb#500
813
883
  def bitmask(*args); end
814
884
 
815
885
  # @overload callback
@@ -817,7 +887,7 @@ module FFI::Library
817
887
  # @raise [ArgumentError]
818
888
  # @return [FFI::CallbackInfo]
819
889
  #
820
- # source://ffi//lib/ffi/library.rb#384
890
+ # source://ffi//lib/ffi/library.rb#330
821
891
  def callback(*args); end
822
892
 
823
893
  # Create a new {FFI::Enum}.
@@ -830,7 +900,7 @@ module FFI::Library
830
900
  # @overload enum
831
901
  # @return [FFI::Enum]
832
902
  #
833
- # source://ffi//lib/ffi/library.rb#511
903
+ # source://ffi//lib/ffi/library.rb#457
834
904
  def enum(*args); end
835
905
 
836
906
  # Find an enum by name.
@@ -838,7 +908,7 @@ module FFI::Library
838
908
  # @param name
839
909
  # @return [FFI::Enum]
840
910
  #
841
- # source://ffi//lib/ffi/library.rb#561
911
+ # source://ffi//lib/ffi/library.rb#507
842
912
  def enum_type(name); end
843
913
 
844
914
  # Find an enum by a symbol it contains.
@@ -846,7 +916,7 @@ module FFI::Library
846
916
  # @param symbol
847
917
  # @return [FFI::Enum]
848
918
  #
849
- # source://ffi//lib/ffi/library.rb#568
919
+ # source://ffi//lib/ffi/library.rb#514
850
920
  def enum_value(symbol); end
851
921
 
852
922
  # Set the calling convention for {#attach_function} and {#callback}
@@ -856,7 +926,7 @@ module FFI::Library
856
926
  # @return [Symbol] the new calling convention
857
927
  # @see http://en.wikipedia.org/wiki/Stdcall#stdcall
858
928
  #
859
- # source://ffi//lib/ffi/library.rb#163
929
+ # source://ffi//lib/ffi/library.rb#106
860
930
  def ffi_convention(convention = T.unsafe(nil)); end
861
931
 
862
932
  # Load native libraries.
@@ -865,7 +935,7 @@ module FFI::Library
865
935
  # @raise [LoadError] if a library cannot be opened
866
936
  # @return [Array<DynamicLibrary>]
867
937
  #
868
- # source://ffi//lib/ffi/library.rb#95
938
+ # source://ffi//lib/ffi/library.rb#89
869
939
  def ffi_lib(*names); end
870
940
 
871
941
  # Sets library flags for {#ffi_lib}.
@@ -875,7 +945,7 @@ module FFI::Library
875
945
  # @param flags [Symbol, …] (see {FlagsMap})
876
946
  # @return [Fixnum] the new value
877
947
  #
878
- # source://ffi//lib/ffi/library.rb#196
948
+ # source://ffi//lib/ffi/library.rb#139
879
949
  def ffi_lib_flags(*flags); end
880
950
 
881
951
  # Get FFI libraries loaded using {#ffi_lib}.
@@ -884,7 +954,7 @@ module FFI::Library
884
954
  # @return [Array<FFI::DynamicLibrary>] array of currently loaded FFI libraries
885
955
  # @see #ffi_lib
886
956
  #
887
- # source://ffi//lib/ffi/library.rb#173
957
+ # source://ffi//lib/ffi/library.rb#116
888
958
  def ffi_libraries; end
889
959
 
890
960
  # Find a type definition.
@@ -892,9 +962,17 @@ module FFI::Library
892
962
  # @param t [DataConverter, Type, Struct, Symbol] type to find
893
963
  # @return [Type]
894
964
  #
895
- # source://ffi//lib/ffi/library.rb#575
965
+ # source://ffi//lib/ffi/library.rb#521
896
966
  def find_type(t); end
897
967
 
968
+ # Freeze all definitions of the module
969
+ #
970
+ # This freezes the module's definitions, so that it can be used in a Ractor.
971
+ # No further methods or variables can be attached and no further enums or typedefs can be created in this module afterwards.
972
+ #
973
+ # source://ffi//lib/ffi/library.rb#568
974
+ def freeze; end
975
+
898
976
  # This function returns a list of possible names to lookup.
899
977
  #
900
978
  # @note Function names on windows may be decorated if they are using stdcall. See
@@ -907,7 +985,7 @@ module FFI::Library
907
985
  # @param arg_types [Array] function's argument types
908
986
  # @return [Array<String>]
909
987
  #
910
- # source://ffi//lib/ffi/library.rb#289
988
+ # source://ffi//lib/ffi/library.rb#232
911
989
  def function_names(name, arg_types); end
912
990
 
913
991
  # Register or get an already registered type definition.
@@ -928,7 +1006,7 @@ module FFI::Library
928
1006
  # @param info [Symbol]
929
1007
  # @return [FFI::Enum, FFI::Type]
930
1008
  #
931
- # source://ffi//lib/ffi/library.rb#428
1009
+ # source://ffi//lib/ffi/library.rb#374
932
1010
  def typedef(old, add, info = T.unsafe(nil)); end
933
1011
 
934
1012
  private
@@ -937,7 +1015,7 @@ module FFI::Library
937
1015
  # @param [Class] klass can be one of FFI::Enum or FFI::Bitmask
938
1016
  # @param args (see #enum or #bitmask)
939
1017
  #
940
- # source://ffi//lib/ffi/library.rb#456
1018
+ # source://ffi//lib/ffi/library.rb#402
941
1019
  def generic_enum(klass, *args); end
942
1020
 
943
1021
  class << self
@@ -947,12 +1025,12 @@ module FFI::Library
947
1025
  # @raise [RuntimeError] if +mod+ is not a Module
948
1026
  # @return [nil]
949
1027
  #
950
- # source://ffi//lib/ffi/library.rb#86
1028
+ # source://ffi//lib/ffi/library.rb#80
951
1029
  def extended(mod); end
952
1030
  end
953
1031
  end
954
1032
 
955
- # source://ffi//lib/ffi/library.rb#79
1033
+ # source://ffi//lib/ffi/library.rb#73
956
1034
  FFI::Library::CURRENT_PROCESS = T.let(T.unsafe(nil), Object)
957
1035
 
958
1036
  # Flags used in {#ffi_lib}.
@@ -960,12 +1038,67 @@ FFI::Library::CURRENT_PROCESS = T.let(T.unsafe(nil), Object)
960
1038
  # This map allows you to supply symbols to {#ffi_lib_flags} instead of
961
1039
  # the actual constants.
962
1040
  #
963
- # source://ffi//lib/ffi/library.rb#182
1041
+ # source://ffi//lib/ffi/library.rb#125
964
1042
  FFI::Library::FlagsMap = T.let(T.unsafe(nil), Hash)
965
1043
 
966
- # source://ffi//lib/ffi/library.rb#80
1044
+ # source://ffi//lib/ffi/library.rb#74
967
1045
  FFI::Library::LIBC = T.let(T.unsafe(nil), String)
968
1046
 
1047
+ # Transform a generic library name and ABI number to a platform library name
1048
+ #
1049
+ # Example:
1050
+ # module LibVips
1051
+ # extend FFI::Library
1052
+ # ffi_lib LibraryPath.new("vips", abi_number: 42)
1053
+ # end
1054
+ #
1055
+ # This translates to the following library file names:
1056
+ # libvips-42.dll on Windows
1057
+ # libvips.so.42 on Linux
1058
+ # libvips.42.dylib on Macos
1059
+ #
1060
+ # See https://packaging.ubuntu.com/html/libraries.html for more information about library naming.
1061
+ #
1062
+ # source://ffi//lib/ffi/library_path.rb#46
1063
+ class FFI::LibraryPath
1064
+ # Build a new library path
1065
+ #
1066
+ # * <tt>name</tt> : The name of the library without file prefix or suffix.
1067
+ # * <tt>abi_number</tt> : The ABI number of the library.
1068
+ # * <tt>root</tt> : An optional base path prepended to the library name.
1069
+ #
1070
+ # @return [LibraryPath] a new instance of LibraryPath
1071
+ #
1072
+ # source://ffi//lib/ffi/library_path.rb#56
1073
+ def initialize(name, abi_number: T.unsafe(nil), root: T.unsafe(nil)); end
1074
+
1075
+ # Returns the value of attribute abi_number.
1076
+ #
1077
+ # source://ffi//lib/ffi/library_path.rb#48
1078
+ def abi_number; end
1079
+
1080
+ # source://ffi//lib/ffi/library_path.rb#78
1081
+ def full_name; end
1082
+
1083
+ # Returns the value of attribute name.
1084
+ #
1085
+ # source://ffi//lib/ffi/library_path.rb#47
1086
+ def name; end
1087
+
1088
+ # Returns the value of attribute root.
1089
+ #
1090
+ # source://ffi//lib/ffi/library_path.rb#49
1091
+ def root; end
1092
+
1093
+ # source://ffi//lib/ffi/library_path.rb#100
1094
+ def to_s; end
1095
+
1096
+ class << self
1097
+ # source://ffi//lib/ffi/library_path.rb#62
1098
+ def wrap(value); end
1099
+ end
1100
+ end
1101
+
969
1102
  # FFI::ManagedStruct allows custom garbage-collection of your FFI::Structs.
970
1103
  #
971
1104
  # The typical use case would be when interacting with a library
@@ -1050,11 +1183,11 @@ FFI::NativeType::VOID = T.let(T.unsafe(nil), FFI::Type::Builtin)
1050
1183
 
1051
1184
  # Exception raised when a function is not found in libraries
1052
1185
  #
1053
- # source://ffi//lib/ffi/library.rb#58
1186
+ # source://ffi//lib/ffi/library.rb#52
1054
1187
  class FFI::NotFoundError < ::LoadError
1055
1188
  # @return [NotFoundError] a new instance of NotFoundError
1056
1189
  #
1057
- # source://ffi//lib/ffi/library.rb#59
1190
+ # source://ffi//lib/ffi/library.rb#53
1058
1191
  def initialize(function, *libraries); end
1059
1192
  end
1060
1193
 
@@ -1063,14 +1196,14 @@ class FFI::NullPointerError < ::RuntimeError; end
1063
1196
  # This module defines different constants and class methods to play with
1064
1197
  # various platforms.
1065
1198
  #
1066
- # source://ffi//lib/ffi/platform.rb#37
1199
+ # source://ffi//lib/ffi/platform.rb#39
1067
1200
  module FFI::Platform
1068
1201
  class << self
1069
1202
  # Test if current OS is a *BSD (include MAC)
1070
1203
  #
1071
1204
  # @return [Boolean]
1072
1205
  #
1073
- # source://ffi//lib/ffi/platform.rb#156
1206
+ # source://ffi//lib/ffi/platform.rb#158
1074
1207
  def bsd?; end
1075
1208
 
1076
1209
  # Test if current OS is +os+.
@@ -1078,35 +1211,35 @@ module FFI::Platform
1078
1211
  # @param os [String]
1079
1212
  # @return [Boolean]
1080
1213
  #
1081
- # source://ffi//lib/ffi/platform.rb#90
1214
+ # source://ffi//lib/ffi/platform.rb#92
1082
1215
  def is_os(os); end
1083
1216
 
1084
1217
  # Test if current OS is Mac OS
1085
1218
  #
1086
1219
  # @return [Boolean]
1087
1220
  #
1088
- # source://ffi//lib/ffi/platform.rb#168
1221
+ # source://ffi//lib/ffi/platform.rb#170
1089
1222
  def mac?; end
1090
1223
 
1091
1224
  # Test if current OS is Solaris (Sun OS)
1092
1225
  #
1093
1226
  # @return [Boolean]
1094
1227
  #
1095
- # source://ffi//lib/ffi/platform.rb#174
1228
+ # source://ffi//lib/ffi/platform.rb#176
1096
1229
  def solaris?; end
1097
1230
 
1098
1231
  # Test if current OS is a unix OS
1099
1232
  #
1100
1233
  # @return [Boolean]
1101
1234
  #
1102
- # source://ffi//lib/ffi/platform.rb#180
1235
+ # source://ffi//lib/ffi/platform.rb#182
1103
1236
  def unix?; end
1104
1237
 
1105
1238
  # Test if current OS is Windows
1106
1239
  #
1107
1240
  # @return [Boolean]
1108
1241
  #
1109
- # source://ffi//lib/ffi/platform.rb#162
1242
+ # source://ffi//lib/ffi/platform.rb#164
1110
1243
  def windows?; end
1111
1244
  end
1112
1245
  end
@@ -1114,16 +1247,16 @@ end
1114
1247
  FFI::Platform::ADDRESS_ALIGN = T.let(T.unsafe(nil), Integer)
1115
1248
  FFI::Platform::ADDRESS_SIZE = T.let(T.unsafe(nil), Integer)
1116
1249
 
1117
- # source://ffi//lib/ffi/platform.rb#63
1250
+ # source://ffi//lib/ffi/platform.rb#65
1118
1251
  FFI::Platform::ARCH = T.let(T.unsafe(nil), String)
1119
1252
 
1120
1253
  FFI::Platform::BIG_ENDIAN = T.let(T.unsafe(nil), Integer)
1121
1254
  FFI::Platform::BYTE_ORDER = T.let(T.unsafe(nil), Integer)
1122
1255
 
1123
- # source://ffi//lib/ffi/platform.rb#109
1256
+ # source://ffi//lib/ffi/platform.rb#111
1124
1257
  FFI::Platform::CONF_DIR = T.let(T.unsafe(nil), String)
1125
1258
 
1126
- # source://ffi//lib/ffi/platform.rb#61
1259
+ # source://ffi//lib/ffi/platform.rb#63
1127
1260
  FFI::Platform::CPU = T.let(T.unsafe(nil), String)
1128
1261
 
1129
1262
  FFI::Platform::DOUBLE_ALIGN = T.let(T.unsafe(nil), Integer)
@@ -1140,43 +1273,43 @@ FFI::Platform::INT64_SIZE = T.let(T.unsafe(nil), Integer)
1140
1273
  FFI::Platform::INT8_ALIGN = T.let(T.unsafe(nil), Integer)
1141
1274
  FFI::Platform::INT8_SIZE = T.let(T.unsafe(nil), Integer)
1142
1275
 
1143
- # source://ffi//lib/ffi/platform.rb#103
1276
+ # source://ffi//lib/ffi/platform.rb#105
1144
1277
  FFI::Platform::IS_BSD = T.let(T.unsafe(nil), FalseClass)
1145
1278
 
1146
- # source://ffi//lib/ffi/platform.rb#100
1279
+ # source://ffi//lib/ffi/platform.rb#102
1147
1280
  FFI::Platform::IS_DRAGONFLYBSD = T.let(T.unsafe(nil), FalseClass)
1148
1281
 
1149
- # source://ffi//lib/ffi/platform.rb#97
1282
+ # source://ffi//lib/ffi/platform.rb#99
1150
1283
  FFI::Platform::IS_FREEBSD = T.let(T.unsafe(nil), FalseClass)
1151
1284
 
1152
- # source://ffi//lib/ffi/platform.rb#94
1285
+ # source://ffi//lib/ffi/platform.rb#96
1153
1286
  FFI::Platform::IS_GNU = T.let(T.unsafe(nil), String)
1154
1287
 
1155
- # source://ffi//lib/ffi/platform.rb#95
1288
+ # source://ffi//lib/ffi/platform.rb#97
1156
1289
  FFI::Platform::IS_LINUX = T.let(T.unsafe(nil), TrueClass)
1157
1290
 
1158
- # source://ffi//lib/ffi/platform.rb#96
1291
+ # source://ffi//lib/ffi/platform.rb#98
1159
1292
  FFI::Platform::IS_MAC = T.let(T.unsafe(nil), FalseClass)
1160
1293
 
1161
- # source://ffi//lib/ffi/platform.rb#98
1294
+ # source://ffi//lib/ffi/platform.rb#100
1162
1295
  FFI::Platform::IS_NETBSD = T.let(T.unsafe(nil), FalseClass)
1163
1296
 
1164
- # source://ffi//lib/ffi/platform.rb#99
1297
+ # source://ffi//lib/ffi/platform.rb#101
1165
1298
  FFI::Platform::IS_OPENBSD = T.let(T.unsafe(nil), FalseClass)
1166
1299
 
1167
- # source://ffi//lib/ffi/platform.rb#101
1300
+ # source://ffi//lib/ffi/platform.rb#103
1168
1301
  FFI::Platform::IS_SOLARIS = T.let(T.unsafe(nil), FalseClass)
1169
1302
 
1170
- # source://ffi//lib/ffi/platform.rb#102
1303
+ # source://ffi//lib/ffi/platform.rb#104
1171
1304
  FFI::Platform::IS_WINDOWS = T.let(T.unsafe(nil), FalseClass)
1172
1305
 
1173
- # source://ffi//lib/ffi/platform.rb#134
1306
+ # source://ffi//lib/ffi/platform.rb#136
1174
1307
  FFI::Platform::LIBC = T.let(T.unsafe(nil), String)
1175
1308
 
1176
- # source://ffi//lib/ffi/platform.rb#113
1309
+ # source://ffi//lib/ffi/platform.rb#115
1177
1310
  FFI::Platform::LIBPREFIX = T.let(T.unsafe(nil), String)
1178
1311
 
1179
- # source://ffi//lib/ffi/platform.rb#122
1312
+ # source://ffi//lib/ffi/platform.rb#124
1180
1313
  FFI::Platform::LIBSUFFIX = T.let(T.unsafe(nil), String)
1181
1314
 
1182
1315
  FFI::Platform::LITTLE_ENDIAN = T.let(T.unsafe(nil), Integer)
@@ -1187,16 +1320,16 @@ FFI::Platform::LONG_SIZE = T.let(T.unsafe(nil), Integer)
1187
1320
 
1188
1321
  # 64-bit inodes
1189
1322
  #
1190
- # source://ffi//lib/ffi/platform.rb#108
1323
+ # source://ffi//lib/ffi/platform.rb#110
1191
1324
  FFI::Platform::NAME = T.let(T.unsafe(nil), String)
1192
1325
 
1193
- # source://ffi//lib/ffi/platform.rb#38
1326
+ # source://ffi//lib/ffi/platform.rb#40
1194
1327
  FFI::Platform::OS = T.let(T.unsafe(nil), String)
1195
1328
 
1196
- # source://ffi//lib/ffi/platform.rb#59
1329
+ # source://ffi//lib/ffi/platform.rb#61
1197
1330
  FFI::Platform::OSVERSION = T.let(T.unsafe(nil), Integer)
1198
1331
 
1199
- # source://ffi//lib/ffi/platform.rb#33
1332
+ # source://ffi//lib/ffi/platform.rb#35
1200
1333
  class FFI::PlatformError < ::LoadError; end
1201
1334
 
1202
1335
  # source://ffi//lib/ffi/pointer.rb#42
@@ -1344,8 +1477,6 @@ FFI::Pointer::NULL = T.let(T.unsafe(nil), FFI::Pointer)
1344
1477
  # source://ffi//lib/ffi/pointer.rb#45
1345
1478
  FFI::Pointer::SIZE = T.let(T.unsafe(nil), Integer)
1346
1479
 
1347
- FFI::SizeTypes = T.let(T.unsafe(nil), Hash)
1348
-
1349
1480
  # This will convert a pointer to a Ruby string (just like `:string`), but
1350
1481
  # also allow to work with the pointer itself. This is useful when you want
1351
1482
  # a Ruby string already containing a copy of the data, but also the pointer
@@ -1354,7 +1485,7 @@ FFI::SizeTypes = T.let(T.unsafe(nil), Hash)
1354
1485
  #
1355
1486
  # It's {typedef}'d as +:strptr+.
1356
1487
  #
1357
- # source://ffi//lib/ffi/types.rb#158
1488
+ # source://ffi//lib/ffi/types.rb#182
1358
1489
  class FFI::StrPtrConverter
1359
1490
  extend ::FFI::DataConverter
1360
1491
 
@@ -1365,7 +1496,7 @@ class FFI::StrPtrConverter
1365
1496
  # @param ctx not used
1366
1497
  # @return [Array(String, Pointer)]
1367
1498
  #
1368
- # source://ffi//lib/ffi/types.rb#166
1499
+ # source://ffi//lib/ffi/types.rb#190
1369
1500
  def from_native(val, ctx); end
1370
1501
  end
1371
1502
  end
@@ -1522,28 +1653,28 @@ class FFI::Struct
1522
1653
 
1523
1654
  protected
1524
1655
 
1525
- # source://ffi//lib/ffi/struct.rb#243
1656
+ # source://ffi//lib/ffi/struct.rb#244
1526
1657
  def align(alignment = T.unsafe(nil)); end
1527
1658
 
1528
- # source://ffi//lib/ffi/struct.rb#243
1659
+ # source://ffi//lib/ffi/struct.rb#244
1529
1660
  def aligned(alignment = T.unsafe(nil)); end
1530
1661
 
1531
- # source://ffi//lib/ffi/struct.rb#229
1662
+ # source://ffi//lib/ffi/struct.rb#230
1532
1663
  def callback(params, ret); end
1533
1664
 
1534
- # source://ffi//lib/ffi/struct.rb#248
1665
+ # source://ffi//lib/ffi/struct.rb#249
1535
1666
  def enclosing_module; end
1536
1667
 
1537
- # source://ffi//lib/ffi/struct.rb#260
1668
+ # source://ffi//lib/ffi/struct.rb#261
1538
1669
  def find_field_type(type, mod = T.unsafe(nil)); end
1539
1670
 
1540
- # source://ffi//lib/ffi/struct.rb#275
1671
+ # source://ffi//lib/ffi/struct.rb#276
1541
1672
  def find_type(type, mod = T.unsafe(nil)); end
1542
1673
 
1543
- # source://ffi//lib/ffi/struct.rb#238
1674
+ # source://ffi//lib/ffi/struct.rb#239
1544
1675
  def pack(packed = T.unsafe(nil)); end
1545
1676
 
1546
- # source://ffi//lib/ffi/struct.rb#238
1677
+ # source://ffi//lib/ffi/struct.rb#239
1547
1678
  def packed(packed = T.unsafe(nil)); end
1548
1679
 
1549
1680
  private
@@ -1554,7 +1685,7 @@ class FFI::Struct
1554
1685
  # @param spec [Array<Symbol, Integer>]
1555
1686
  # @return [builder]
1556
1687
  #
1557
- # source://ffi//lib/ffi/struct.rb#297
1688
+ # source://ffi//lib/ffi/struct.rb#298
1558
1689
  def array_layout(builder, spec); end
1559
1690
 
1560
1691
  # Add hash +spec+ to +builder+.
@@ -1563,7 +1694,7 @@ class FFI::Struct
1563
1694
  # @param spec [Hash]
1564
1695
  # @return [builder]
1565
1696
  #
1566
- # source://ffi//lib/ffi/struct.rb#287
1697
+ # source://ffi//lib/ffi/struct.rb#288
1567
1698
  def hash_layout(builder, spec); end
1568
1699
  end
1569
1700
  end
@@ -1936,6 +2067,7 @@ FFI::Type::LONG_LONG = T.let(T.unsafe(nil), FFI::Type::Builtin)
1936
2067
  class FFI::Type::Mapped < ::FFI::Type
1937
2068
  def initialize(_arg0); end
1938
2069
 
2070
+ def converter; end
1939
2071
  def from_native(*_arg0); end
1940
2072
  def native_type; end
1941
2073
  def to_native(*_arg0); end
@@ -1964,7 +2096,7 @@ FFI::Type::VARARGS = T.let(T.unsafe(nil), FFI::Type::Builtin)
1964
2096
  FFI::Type::VOID = T.let(T.unsafe(nil), FFI::Type::Builtin)
1965
2097
  FFI::TypeDefs = T.let(T.unsafe(nil), Hash)
1966
2098
 
1967
- # source://ffi//lib/ffi/library.rb#32
2099
+ # source://ffi//lib/ffi/library.rb#34
1968
2100
  FFI::USE_THIS_PROCESS_AS_LIBRARY = T.let(T.unsafe(nil), Object)
1969
2101
 
1970
2102
  # source://ffi//lib/ffi/union.rb#36
@@ -1991,4 +2123,15 @@ class FFI::VariadicInvoker
1991
2123
  def call(*args, &block); end
1992
2124
 
1993
2125
  def invoke(_arg0, _arg1); end
2126
+
2127
+ # Retrieve Array of parameter types
2128
+ #
2129
+ # This method returns an Array of FFI types accepted as function parameters.
2130
+ #
2131
+ # @return [Array<FFI::Type>]
2132
+ #
2133
+ # source://ffi//lib/ffi/variadic.rb#76
2134
+ def param_types; end
2135
+
2136
+ def return_type; end
1994
2137
  end