xberg 1.3.10 → 1.4.2

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.
data/lib/xberg/native.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:ad1111808fdffa3c9fab07200ef47104e14b36ee18f21896c08af7bec50b6095
2
+ # alef:hash:fafafecfaacb875a03c9069c98499909fd50db8d01ba89b2a6176281446abd7e
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify
5
5
  # frozen_string_literal: true
@@ -370,7 +370,7 @@ module Xberg
370
370
  # @return [self]
371
371
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
372
372
  def self.from_hash(hash)
373
- new(url: hash[:url] || hash["url"], title: hash[:title] || hash["title"])
373
+ new(url: hash.key?(:url) ? hash[:url] : hash["url"], title: hash.key?(:title) ? hash[:title] : hash["title"])
374
374
  end
375
375
  end
376
376
  ## Highlighted text (PDF highlights, HTML `<mark>`).
@@ -445,7 +445,7 @@ module Xberg
445
445
  # @return [self]
446
446
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
447
447
  def self.from_hash(hash)
448
- new(value: hash[:value] || hash["value"])
448
+ new(value: hash.key?(:value) ? hash[:value] : hash["value"])
449
449
  end
450
450
  end
451
451
  ## Font size with units (e.g. "12pt", "1.2em", "16px").
@@ -484,7 +484,7 @@ module Xberg
484
484
  # @return [self]
485
485
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
486
486
  def self.from_hash(hash)
487
- new(value: hash[:value] || hash["value"])
487
+ new(value: hash.key?(:value) ? hash[:value] : hash["value"])
488
488
  end
489
489
  end
490
490
  ## Extensible annotation for format-specific styling.
@@ -526,7 +526,7 @@ module Xberg
526
526
  # @return [self]
527
527
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
528
528
  def self.from_hash(hash)
529
- new(name: hash[:name] || hash["name"], value: hash[:value] || hash["value"])
529
+ new(name: hash.key?(:name) ? hash[:name] : hash["name"], value: hash.key?(:value) ? hash[:value] : hash["value"])
530
530
  end
531
531
  end
532
532
  end
@@ -578,7 +578,10 @@ module Xberg
578
578
  # @return [self]
579
579
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
580
580
  def self.from_hash(hash)
581
- new(username: hash[:username] || hash["username"], password: hash[:password] || hash["password"])
581
+ new(
582
+ username: hash.key?(:username) ? hash[:username] : hash["username"],
583
+ password: hash.key?(:password) ? hash[:password] : hash["password"]
584
+ )
582
585
  end
583
586
  end
584
587
  ## Bearer token authentication.
@@ -599,7 +602,7 @@ module Xberg
599
602
  # @return [self]
600
603
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
601
604
  def self.from_hash(hash)
602
- new(token: hash[:token] || hash["token"])
605
+ new(token: hash.key?(:token) ? hash[:token] : hash["token"])
603
606
  end
604
607
  end
605
608
  ## Custom authentication header.
@@ -623,7 +626,7 @@ module Xberg
623
626
  # @return [self]
624
627
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
625
628
  def self.from_hash(hash)
626
- new(name: hash[:name] || hash["name"], value: hash[:value] || hash["value"])
629
+ new(name: hash.key?(:name) ? hash[:name] : hash["name"], value: hash.key?(:value) ? hash[:value] : hash["value"])
627
630
  end
628
631
  end
629
632
  end
@@ -702,7 +705,10 @@ module Xberg
702
705
  # @return [self]
703
706
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
704
707
  def self.from_hash(hash)
705
- new(model: hash[:model] || hash["model"], cache_dir: hash[:cache_dir] || hash["cache_dir"])
708
+ new(
709
+ model: hash.key?(:model) ? hash[:model] : hash["model"],
710
+ cache_dir: hash.key?(:cache_dir) ? hash[:cache_dir] : hash["cache_dir"]
711
+ )
706
712
  end
707
713
  end
708
714
  end
@@ -759,8 +765,8 @@ module Xberg
759
765
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
760
766
  def self.from_hash(hash)
761
767
  new(
762
- size_bytes: hash[:size_bytes] || hash["size_bytes"],
763
- threshold_bytes: hash[:threshold_bytes] || hash["threshold_bytes"]
768
+ size_bytes: hash.key?(:size_bytes) ? hash[:size_bytes] : hash["size_bytes"],
769
+ threshold_bytes: hash.key?(:threshold_bytes) ? hash[:threshold_bytes] : hash["threshold_bytes"]
764
770
  )
765
771
  end
766
772
  end
@@ -787,7 +793,10 @@ module Xberg
787
793
  # @return [self]
788
794
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
789
795
  def self.from_hash(hash)
790
- new(page_count: hash[:page_count] || hash["page_count"], threshold: hash[:threshold] || hash["threshold"])
796
+ new(
797
+ page_count: hash.key?(:page_count) ? hash[:page_count] : hash["page_count"],
798
+ threshold: hash.key?(:threshold) ? hash[:threshold] : hash["threshold"]
799
+ )
791
800
  end
792
801
  end
793
802
  ## PDF requires OCR and is large.
@@ -813,7 +822,10 @@ module Xberg
813
822
  # @return [self]
814
823
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
815
824
  def self.from_hash(hash)
816
- new(page_count: hash[:page_count] || hash["page_count"], force_ocr: hash[:force_ocr] || hash["force_ocr"])
825
+ new(
826
+ page_count: hash.key?(:page_count) ? hash[:page_count] : hash["page_count"],
827
+ force_ocr: hash.key?(:force_ocr) ? hash[:force_ocr] : hash["force_ocr"]
828
+ )
817
829
  end
818
830
  end
819
831
  ## Both size and page count exceed thresholds.
@@ -839,7 +851,10 @@ module Xberg
839
851
  # @return [self]
840
852
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
841
853
  def self.from_hash(hash)
842
- new(size_bytes: hash[:size_bytes] || hash["size_bytes"], page_count: hash[:page_count] || hash["page_count"])
854
+ new(
855
+ size_bytes: hash.key?(:size_bytes) ? hash[:size_bytes] : hash["size_bytes"],
856
+ page_count: hash.key?(:page_count) ? hash[:page_count] : hash["page_count"]
857
+ )
843
858
  end
844
859
  end
845
860
  end
@@ -910,10 +925,10 @@ module Xberg
910
925
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
911
926
  def self.from_hash(hash)
912
927
  new(
913
- tenant_id: hash[:tenant_id] || hash["tenant_id"],
914
- client_id: hash[:client_id] || hash["client_id"],
915
- client_secret: hash[:client_secret] || hash["client_secret"],
916
- scope: hash[:scope] || hash["scope"]
928
+ tenant_id: hash.key?(:tenant_id) ? hash[:tenant_id] : hash["tenant_id"],
929
+ client_id: hash.key?(:client_id) ? hash[:client_id] : hash["client_id"],
930
+ client_secret: hash.key?(:client_secret) ? hash[:client_secret] : hash["client_secret"],
931
+ scope: hash.key?(:scope) ? hash[:scope] : hash["scope"]
917
932
  )
918
933
  end
919
934
  end
@@ -947,8 +962,10 @@ module Xberg
947
962
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
948
963
  def self.from_hash(hash)
949
964
  new(
950
- service_account_key_file: hash[:service_account_key_file] || hash["service_account_key_file"],
951
- scope: hash[:scope] || hash["scope"]
965
+ service_account_key_file: hash.key?(:service_account_key_file) ? hash[:service_account_key_file] : hash[
966
+ "service_account_key_file"
967
+ ],
968
+ scope: hash.key?(:scope) ? hash[:scope] : hash["scope"]
952
969
  )
953
970
  end
954
971
  end
@@ -973,7 +990,7 @@ module Xberg
973
990
  # @return [self]
974
991
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
975
992
  def self.from_hash(hash)
976
- new(scope: hash[:scope] || hash["scope"])
993
+ new(scope: hash.key?(:scope) ? hash[:scope] : hash["scope"])
977
994
  end
978
995
  end
979
996
  ## AWS STS `AssumeRoleWithWebIdentity` (EKS IRSA / OIDC federation) for Bedrock.
@@ -1008,10 +1025,10 @@ module Xberg
1008
1025
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
1009
1026
  def self.from_hash(hash)
1010
1027
  new(
1011
- role_arn: hash[:role_arn] || hash["role_arn"],
1012
- token_file: hash[:token_file] || hash["token_file"],
1013
- session_name: hash[:session_name] || hash["session_name"],
1014
- region: hash[:region] || hash["region"]
1028
+ role_arn: hash.key?(:role_arn) ? hash[:role_arn] : hash["role_arn"],
1029
+ token_file: hash.key?(:token_file) ? hash[:token_file] : hash["token_file"],
1030
+ session_name: hash.key?(:session_name) ? hash[:session_name] : hash["session_name"],
1031
+ region: hash.key?(:region) ? hash[:region] : hash["region"]
1015
1032
  )
1016
1033
  end
1017
1034
  end
@@ -1065,7 +1082,7 @@ module Xberg
1065
1082
  # @return [self]
1066
1083
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
1067
1084
  def self.from_hash(hash)
1068
- new(value: hash[:text] || hash["text"])
1085
+ new(value: hash.key?(:text) ? hash[:text] : hash["text"])
1069
1086
  end
1070
1087
  end
1071
1088
  ## Line added in the "after" version.
@@ -1086,7 +1103,7 @@ module Xberg
1086
1103
  # @return [self]
1087
1104
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
1088
1105
  def self.from_hash(hash)
1089
- new(value: hash[:text] || hash["text"])
1106
+ new(value: hash.key?(:text) ? hash[:text] : hash["text"])
1090
1107
  end
1091
1108
  end
1092
1109
  ## Line removed from the "before" version.
@@ -1107,7 +1124,7 @@ module Xberg
1107
1124
  # @return [self]
1108
1125
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
1109
1126
  def self.from_hash(hash)
1110
- new(value: hash[:text] || hash["text"])
1127
+ new(value: hash.key?(:text) ? hash[:text] : hash["text"])
1111
1128
  end
1112
1129
  end
1113
1130
  end
@@ -1160,7 +1177,7 @@ module Xberg
1160
1177
  # @return [self]
1161
1178
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
1162
1179
  def self.from_hash(hash)
1163
- new(name: hash[:name] || hash["name"])
1180
+ new(name: hash.key?(:name) ? hash[:name] : hash["name"])
1164
1181
  end
1165
1182
  end
1166
1183
  ## Use a custom ONNX model from HuggingFace
@@ -1186,7 +1203,10 @@ module Xberg
1186
1203
  # @return [self]
1187
1204
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
1188
1205
  def self.from_hash(hash)
1189
- new(model_id: hash[:model_id] || hash["model_id"], dimensions: hash[:dimensions] || hash["dimensions"])
1206
+ new(
1207
+ model_id: hash.key?(:model_id) ? hash[:model_id] : hash["model_id"],
1208
+ dimensions: hash.key?(:dimensions) ? hash[:dimensions] : hash["dimensions"]
1209
+ )
1190
1210
  end
1191
1211
  end
1192
1212
  ## Provider-hosted embedding model via liter-llm.
@@ -1216,7 +1236,7 @@ module Xberg
1216
1236
  # @return [self]
1217
1237
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
1218
1238
  def self.from_hash(hash)
1219
- new(llm: hash[:llm] || hash["llm"])
1239
+ new(llm: hash.key?(:llm) ? hash[:llm] : hash["llm"])
1220
1240
  end
1221
1241
  end
1222
1242
  ## In-process embedding backend registered via the plugin system.
@@ -1257,7 +1277,7 @@ module Xberg
1257
1277
  # @return [self]
1258
1278
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
1259
1279
  def self.from_hash(hash)
1260
- new(name: hash[:name] || hash["name"])
1280
+ new(name: hash.key?(:name) ? hash[:name] : hash["name"])
1261
1281
  end
1262
1282
  end
1263
1283
  end
@@ -2615,7 +2635,7 @@ module Xberg
2615
2635
  # @return [self]
2616
2636
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
2617
2637
  def self.from_hash(hash)
2618
- new(value: hash[:value] || hash["value"])
2638
+ new(value: hash.key?(:value) ? hash[:value] : hash["value"])
2619
2639
  end
2620
2640
  end
2621
2641
  ## Suffix match: ".xberg.io" matches "api.xberg.io" and "xberg.io".
@@ -2636,7 +2656,7 @@ module Xberg
2636
2656
  # @return [self]
2637
2657
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
2638
2658
  def self.from_hash(hash)
2639
- new(value: hash[:value] || hash["value"])
2659
+ new(value: hash.key?(:value) ? hash[:value] : hash["value"])
2640
2660
  end
2641
2661
  end
2642
2662
  ## CIDR match: "10.0.0.0/8" matches IP addresses in that range.
@@ -2658,7 +2678,7 @@ module Xberg
2658
2678
  # @return [self]
2659
2679
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
2660
2680
  def self.from_hash(hash)
2661
- new(value: hash[:value] || hash["value"])
2681
+ new(value: hash.key?(:value) ? hash[:value] : hash["value"])
2662
2682
  end
2663
2683
  end
2664
2684
  end
@@ -2789,7 +2809,7 @@ module Xberg
2789
2809
  # @return [self]
2790
2810
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
2791
2811
  def self.from_hash(hash)
2792
- new(quality: hash[:quality] || hash["quality"])
2812
+ new(quality: hash.key?(:quality) ? hash[:quality] : hash["quality"])
2793
2813
  end
2794
2814
  end
2795
2815
  ## Re-encode all extracted images as WebP at the given quality level.
@@ -2819,7 +2839,7 @@ module Xberg
2819
2839
  # @return [self]
2820
2840
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
2821
2841
  def self.from_hash(hash)
2822
- new(quality: hash[:quality] || hash["quality"])
2842
+ new(quality: hash.key?(:quality) ? hash[:quality] : hash["quality"])
2823
2843
  end
2824
2844
  end
2825
2845
  ## Re-encode all extracted images as HEIF/HEIC at the given quality level.
@@ -2852,7 +2872,7 @@ module Xberg
2852
2872
  # @return [self]
2853
2873
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
2854
2874
  def self.from_hash(hash)
2855
- new(quality: hash[:quality] || hash["quality"])
2875
+ new(quality: hash.key?(:quality) ? hash[:quality] : hash["quality"])
2856
2876
  end
2857
2877
  end
2858
2878
  ## Output pure-vector SVG. Lossless. Raster sources are not re-encoded
@@ -2932,7 +2952,7 @@ module Xberg
2932
2952
  # @return [self]
2933
2953
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
2934
2954
  def self.from_hash(hash)
2935
- new(name: hash[:name] || hash["name"])
2955
+ new(name: hash.key?(:name) ? hash[:name] : hash["name"])
2936
2956
  end
2937
2957
  end
2938
2958
  ## Use a custom ColBERT ONNX model from HuggingFace.
@@ -2964,10 +2984,10 @@ module Xberg
2964
2984
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
2965
2985
  def self.from_hash(hash)
2966
2986
  new(
2967
- model_id: hash[:model_id] || hash["model_id"],
2968
- model_file: hash[:model_file] || hash["model_file"],
2969
- additional_files: hash[:additional_files] || hash["additional_files"],
2970
- max_length: hash[:max_length] || hash["max_length"]
2987
+ model_id: hash.key?(:model_id) ? hash[:model_id] : hash["model_id"],
2988
+ model_file: hash.key?(:model_file) ? hash[:model_file] : hash["model_file"],
2989
+ additional_files: hash.key?(:additional_files) ? hash[:additional_files] : hash["additional_files"],
2990
+ max_length: hash.key?(:max_length) ? hash[:max_length] : hash["max_length"]
2971
2991
  )
2972
2992
  end
2973
2993
  end
@@ -2989,7 +3009,7 @@ module Xberg
2989
3009
  # @return [self]
2990
3010
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
2991
3011
  def self.from_hash(hash)
2992
- new(name: hash[:name] || hash["name"])
3012
+ new(name: hash.key?(:name) ? hash[:name] : hash["name"])
2993
3013
  end
2994
3014
  end
2995
3015
  end
@@ -3054,8 +3074,8 @@ module Xberg
3054
3074
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3055
3075
  def self.from_hash(hash)
3056
3076
  new(
3057
- size_bytes: hash[:size_bytes] || hash["size_bytes"],
3058
- threshold_bytes: hash[:threshold_bytes] || hash["threshold_bytes"]
3077
+ size_bytes: hash.key?(:size_bytes) ? hash[:size_bytes] : hash["size_bytes"],
3078
+ threshold_bytes: hash.key?(:threshold_bytes) ? hash[:threshold_bytes] : hash["threshold_bytes"]
3059
3079
  )
3060
3080
  end
3061
3081
  end
@@ -3086,7 +3106,10 @@ module Xberg
3086
3106
  # @return [self]
3087
3107
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3088
3108
  def self.from_hash(hash)
3089
- new(page_count: hash[:page_count] || hash["page_count"], threshold: hash[:threshold] || hash["threshold"])
3109
+ new(
3110
+ page_count: hash.key?(:page_count) ? hash[:page_count] : hash["page_count"],
3111
+ threshold: hash.key?(:threshold) ? hash[:threshold] : hash["threshold"]
3112
+ )
3090
3113
  end
3091
3114
  end
3092
3115
  ## PDF has substantial text layer (OCR not needed).
@@ -3117,8 +3140,8 @@ module Xberg
3117
3140
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3118
3141
  def self.from_hash(hash)
3119
3142
  new(
3120
- text_coverage: hash[:text_coverage] || hash["text_coverage"],
3121
- avg_chars_per_page: hash[:avg_chars_per_page] || hash["avg_chars_per_page"]
3143
+ text_coverage: hash.key?(:text_coverage) ? hash[:text_coverage] : hash["text_coverage"],
3144
+ avg_chars_per_page: hash.key?(:avg_chars_per_page) ? hash[:avg_chars_per_page] : hash["avg_chars_per_page"]
3122
3145
  )
3123
3146
  end
3124
3147
  end
@@ -3146,7 +3169,7 @@ module Xberg
3146
3169
  # @return [self]
3147
3170
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3148
3171
  def self.from_hash(hash)
3149
- new(mime_type: hash[:mime_type] || hash["mime_type"])
3172
+ new(mime_type: hash.key?(:mime_type) ? hash[:mime_type] : hash["mime_type"])
3150
3173
  end
3151
3174
  end
3152
3175
  ## Chunking is disabled by configuration.
@@ -3318,7 +3341,7 @@ module Xberg
3318
3341
  # @return [self]
3319
3342
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3320
3343
  def self.from_hash(hash)
3321
- new(text: hash[:text] || hash["text"])
3344
+ new(text: hash.key?(:text) ? hash[:text] : hash["text"])
3322
3345
  end
3323
3346
  end
3324
3347
  ## Section heading with level (1-6).
@@ -3378,7 +3401,7 @@ module Xberg
3378
3401
  # @return [self]
3379
3402
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3380
3403
  def self.from_hash(hash)
3381
- new(level: hash[:level] || hash["level"], text: hash[:text] || hash["text"])
3404
+ new(level: hash.key?(:level) ? hash[:level] : hash["level"], text: hash.key?(:text) ? hash[:text] : hash["text"])
3382
3405
  end
3383
3406
  end
3384
3407
  ## Body text paragraph.
@@ -3435,7 +3458,7 @@ module Xberg
3435
3458
  # @return [self]
3436
3459
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3437
3460
  def self.from_hash(hash)
3438
- new(text: hash[:text] || hash["text"])
3461
+ new(text: hash.key?(:text) ? hash[:text] : hash["text"])
3439
3462
  end
3440
3463
  end
3441
3464
  ## List container — children are `ListItem` nodes.
@@ -3492,7 +3515,7 @@ module Xberg
3492
3515
  # @return [self]
3493
3516
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3494
3517
  def self.from_hash(hash)
3495
- new(ordered: hash[:ordered] || hash["ordered"])
3518
+ new(ordered: hash.key?(:ordered) ? hash[:ordered] : hash["ordered"])
3496
3519
  end
3497
3520
  end
3498
3521
  ## Individual list item.
@@ -3549,7 +3572,7 @@ module Xberg
3549
3572
  # @return [self]
3550
3573
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3551
3574
  def self.from_hash(hash)
3552
- new(text: hash[:text] || hash["text"])
3575
+ new(text: hash.key?(:text) ? hash[:text] : hash["text"])
3553
3576
  end
3554
3577
  end
3555
3578
  ## Table with structured cell grid.
@@ -3606,7 +3629,7 @@ module Xberg
3606
3629
  # @return [self]
3607
3630
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3608
3631
  def self.from_hash(hash)
3609
- new(grid: hash[:grid] || hash["grid"])
3632
+ new(grid: hash.key?(:grid) ? hash[:grid] : hash["grid"])
3610
3633
  end
3611
3634
  end
3612
3635
  ## Image reference.
@@ -3670,9 +3693,9 @@ module Xberg
3670
3693
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3671
3694
  def self.from_hash(hash)
3672
3695
  new(
3673
- description: hash[:description] || hash["description"],
3674
- image_index: hash[:image_index] || hash["image_index"],
3675
- src: hash[:src] || hash["src"]
3696
+ description: hash.key?(:description) ? hash[:description] : hash["description"],
3697
+ image_index: hash.key?(:image_index) ? hash[:image_index] : hash["image_index"],
3698
+ src: hash.key?(:src) ? hash[:src] : hash["src"]
3676
3699
  )
3677
3700
  end
3678
3701
  end
@@ -3733,7 +3756,10 @@ module Xberg
3733
3756
  # @return [self]
3734
3757
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3735
3758
  def self.from_hash(hash)
3736
- new(text: hash[:text] || hash["text"], language: hash[:language] || hash["language"])
3759
+ new(
3760
+ text: hash.key?(:text) ? hash[:text] : hash["text"],
3761
+ language: hash.key?(:language) ? hash[:language] : hash["language"]
3762
+ )
3737
3763
  end
3738
3764
  end
3739
3765
  ## Block quote — container, children carry the quoted content.
@@ -3844,7 +3870,7 @@ module Xberg
3844
3870
  # @return [self]
3845
3871
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3846
3872
  def self.from_hash(hash)
3847
- new(text: hash[:text] || hash["text"])
3873
+ new(text: hash.key?(:text) ? hash[:text] : hash["text"])
3848
3874
  end
3849
3875
  end
3850
3876
  ## Footnote reference content.
@@ -3901,7 +3927,7 @@ module Xberg
3901
3927
  # @return [self]
3902
3928
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3903
3929
  def self.from_hash(hash)
3904
- new(text: hash[:text] || hash["text"])
3930
+ new(text: hash.key?(:text) ? hash[:text] : hash["text"])
3905
3931
  end
3906
3932
  end
3907
3933
  ## Reviewer/editor comment content (e.g. DOCX comments).
@@ -3962,7 +3988,7 @@ module Xberg
3962
3988
  # @return [self]
3963
3989
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
3964
3990
  def self.from_hash(hash)
3965
- new(text: hash[:text] || hash["text"])
3991
+ new(text: hash.key?(:text) ? hash[:text] : hash["text"])
3966
3992
  end
3967
3993
  end
3968
3994
  ## Logical grouping container (section, key-value area).
@@ -4029,9 +4055,9 @@ module Xberg
4029
4055
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4030
4056
  def self.from_hash(hash)
4031
4057
  new(
4032
- label: hash[:label] || hash["label"],
4033
- heading_level: hash[:heading_level] || hash["heading_level"],
4034
- heading_text: hash[:heading_text] || hash["heading_text"]
4058
+ label: hash.key?(:label) ? hash[:label] : hash["label"],
4059
+ heading_level: hash.key?(:heading_level) ? hash[:heading_level] : hash["heading_level"],
4060
+ heading_text: hash.key?(:heading_text) ? hash[:heading_text] : hash["heading_text"]
4035
4061
  )
4036
4062
  end
4037
4063
  end
@@ -4146,7 +4172,10 @@ module Xberg
4146
4172
  # @return [self]
4147
4173
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4148
4174
  def self.from_hash(hash)
4149
- new(number: hash[:number] || hash["number"], title: hash[:title] || hash["title"])
4175
+ new(
4176
+ number: hash.key?(:number) ? hash[:number] : hash["number"],
4177
+ title: hash.key?(:title) ? hash[:title] : hash["title"]
4178
+ )
4150
4179
  end
4151
4180
  end
4152
4181
  ## Definition list container — children are `DefinitionItem` nodes.
@@ -4260,7 +4289,10 @@ module Xberg
4260
4289
  # @return [self]
4261
4290
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4262
4291
  def self.from_hash(hash)
4263
- new(term: hash[:term] || hash["term"], definition: hash[:definition] || hash["definition"])
4292
+ new(
4293
+ term: hash.key?(:term) ? hash[:term] : hash["term"],
4294
+ definition: hash.key?(:definition) ? hash[:definition] : hash["definition"]
4295
+ )
4264
4296
  end
4265
4297
  end
4266
4298
  ## Citation or bibliographic reference.
@@ -4320,7 +4352,7 @@ module Xberg
4320
4352
  # @return [self]
4321
4353
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4322
4354
  def self.from_hash(hash)
4323
- new(key: hash[:key] || hash["key"], text: hash[:text] || hash["text"])
4355
+ new(key: hash.key?(:key) ? hash[:key] : hash["key"], text: hash.key?(:text) ? hash[:text] : hash["text"])
4324
4356
  end
4325
4357
  end
4326
4358
  ## Admonition / callout container (note, warning, tip, etc.).
@@ -4382,7 +4414,7 @@ module Xberg
4382
4414
  # @return [self]
4383
4415
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4384
4416
  def self.from_hash(hash)
4385
- new(kind: hash[:kind] || hash["kind"], title: hash[:title] || hash["title"])
4417
+ new(kind: hash.key?(:kind) ? hash[:kind] : hash["kind"], title: hash.key?(:title) ? hash[:title] : hash["title"])
4386
4418
  end
4387
4419
  end
4388
4420
  ## Raw block preserved verbatim from the source format.
@@ -4445,7 +4477,10 @@ module Xberg
4445
4477
  # @return [self]
4446
4478
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4447
4479
  def self.from_hash(hash)
4448
- new(format: hash[:format] || hash["format"], content: hash[:content] || hash["content"])
4480
+ new(
4481
+ format: hash.key?(:format) ? hash[:format] : hash["format"],
4482
+ content: hash.key?(:content) ? hash[:content] : hash["content"]
4483
+ )
4449
4484
  end
4450
4485
  end
4451
4486
  ## Structured metadata block (email headers, YAML frontmatter, etc.).
@@ -4502,7 +4537,7 @@ module Xberg
4502
4537
  # @return [self]
4503
4538
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4504
4539
  def self.from_hash(hash)
4505
- new(entries: hash[:entries] || hash["entries"])
4540
+ new(entries: hash.key?(:entries) ? hash[:entries] : hash["entries"])
4506
4541
  end
4507
4542
  end
4508
4543
  end
@@ -4560,10 +4595,10 @@ module Xberg
4560
4595
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4561
4596
  def self.from_hash(hash)
4562
4597
  new(
4563
- left: hash[:left] || hash["left"],
4564
- top: hash[:top] || hash["top"],
4565
- width: hash[:width] || hash["width"],
4566
- height: hash[:height] || hash["height"]
4598
+ left: hash.key?(:left) ? hash[:left] : hash["left"],
4599
+ top: hash.key?(:top) ? hash[:top] : hash["top"],
4600
+ width: hash.key?(:width) ? hash[:width] : hash["width"],
4601
+ height: hash.key?(:height) ? hash[:height] : hash["height"]
4567
4602
  )
4568
4603
  end
4569
4604
  end
@@ -4586,7 +4621,7 @@ module Xberg
4586
4621
  # @return [self]
4587
4622
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4588
4623
  def self.from_hash(hash)
4589
- new(points: hash[:points] || hash["points"])
4624
+ new(points: hash.key?(:points) ? hash[:points] : hash["points"])
4590
4625
  end
4591
4626
  end
4592
4627
  end
@@ -4661,7 +4696,7 @@ module Xberg
4661
4696
  # @return [self]
4662
4697
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4663
4698
  def self.from_hash(hash)
4664
- new(min_confidence: hash[:min_confidence] || hash["min_confidence"])
4699
+ new(min_confidence: hash.key?(:min_confidence) ? hash[:min_confidence] : hash["min_confidence"])
4665
4700
  end
4666
4701
  end
4667
4702
  end
@@ -4714,7 +4749,7 @@ module Xberg
4714
4749
  # @return [self]
4715
4750
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4716
4751
  def self.from_hash(hash)
4717
- new(name: hash[:name] || hash["name"])
4752
+ new(name: hash.key?(:name) ? hash[:name] : hash["name"])
4718
4753
  end
4719
4754
  end
4720
4755
  ## Use a custom ONNX cross-encoder from HuggingFace.
@@ -4765,11 +4800,11 @@ module Xberg
4765
4800
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4766
4801
  def self.from_hash(hash)
4767
4802
  new(
4768
- model_id: hash[:model_id] || hash["model_id"],
4769
- model_file: hash[:model_file] || hash["model_file"],
4770
- additional_files: hash[:additional_files] || hash["additional_files"],
4771
- max_length: hash[:max_length] || hash["max_length"],
4772
- head: hash[:head] || hash["head"]
4803
+ model_id: hash.key?(:model_id) ? hash[:model_id] : hash["model_id"],
4804
+ model_file: hash.key?(:model_file) ? hash[:model_file] : hash["model_file"],
4805
+ additional_files: hash.key?(:additional_files) ? hash[:additional_files] : hash["additional_files"],
4806
+ max_length: hash.key?(:max_length) ? hash[:max_length] : hash["max_length"],
4807
+ head: hash.key?(:head) ? hash[:head] : hash["head"]
4773
4808
  )
4774
4809
  end
4775
4810
  end
@@ -4799,7 +4834,7 @@ module Xberg
4799
4834
  # @return [self]
4800
4835
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4801
4836
  def self.from_hash(hash)
4802
- new(llm: hash[:llm] || hash["llm"])
4837
+ new(llm: hash.key?(:llm) ? hash[:llm] : hash["llm"])
4803
4838
  end
4804
4839
  end
4805
4840
  ## In-process reranker registered via the plugin system.
@@ -4834,7 +4869,7 @@ module Xberg
4834
4869
  # @return [self]
4835
4870
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4836
4871
  def self.from_hash(hash)
4837
- new(name: hash[:name] || hash["name"])
4872
+ new(name: hash.key?(:name) ? hash[:name] : hash["name"])
4838
4873
  end
4839
4874
  end
4840
4875
  end
@@ -4891,7 +4926,7 @@ module Xberg
4891
4926
  # @return [self]
4892
4927
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4893
4928
  def self.from_hash(hash)
4894
- new(index: hash[:index] || hash["index"])
4929
+ new(index: hash.key?(:index) ? hash[:index] : hash["index"])
4895
4930
  end
4896
4931
  end
4897
4932
  ## Cell inside a table.
@@ -4923,9 +4958,9 @@ module Xberg
4923
4958
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4924
4959
  def self.from_hash(hash)
4925
4960
  new(
4926
- row: hash[:row] || hash["row"],
4927
- col: hash[:col] || hash["col"],
4928
- table_index: hash[:table_index] || hash["table_index"]
4961
+ row: hash.key?(:row) ? hash[:row] : hash["row"],
4962
+ col: hash.key?(:col) ? hash[:col] : hash["col"],
4963
+ table_index: hash.key?(:table_index) ? hash[:table_index] : hash["table_index"]
4929
4964
  )
4930
4965
  end
4931
4966
  end
@@ -4951,7 +4986,7 @@ module Xberg
4951
4986
  # @return [self]
4952
4987
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4953
4988
  def self.from_hash(hash)
4954
- new(index: hash[:index] || hash["index"])
4989
+ new(index: hash.key?(:index) ? hash[:index] : hash["index"])
4955
4990
  end
4956
4991
  end
4957
4992
  ## Presentation slide, identified by its zero-based index.
@@ -4976,7 +5011,7 @@ module Xberg
4976
5011
  # @return [self]
4977
5012
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
4978
5013
  def self.from_hash(hash)
4979
- new(index: hash[:index] || hash["index"])
5014
+ new(index: hash.key?(:index) ? hash[:index] : hash["index"])
4980
5015
  end
4981
5016
  end
4982
5017
  ## Spreadsheet cell or range, identified by sheet index and optional name.
@@ -5004,7 +5039,7 @@ module Xberg
5004
5039
  # @return [self]
5005
5040
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
5006
5041
  def self.from_hash(hash)
5007
- new(index: hash[:index] || hash["index"], name: hash[:name] || hash["name"])
5042
+ new(index: hash.key?(:index) ? hash[:index] : hash["index"], name: hash.key?(:name) ? hash[:name] : hash["name"])
5008
5043
  end
5009
5044
  end
5010
5045
  end
@@ -5053,7 +5088,7 @@ module Xberg
5053
5088
  # @return [self]
5054
5089
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
5055
5090
  def self.from_hash(hash)
5056
- new(name: hash[:name] || hash["name"])
5091
+ new(name: hash.key?(:name) ? hash[:name] : hash["name"])
5057
5092
  end
5058
5093
  end
5059
5094
  ## Use a custom SPLADE (`BertForMaskedLM`) ONNX model from HuggingFace.
@@ -5085,10 +5120,10 @@ module Xberg
5085
5120
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
5086
5121
  def self.from_hash(hash)
5087
5122
  new(
5088
- model_id: hash[:model_id] || hash["model_id"],
5089
- model_file: hash[:model_file] || hash["model_file"],
5090
- additional_files: hash[:additional_files] || hash["additional_files"],
5091
- max_length: hash[:max_length] || hash["max_length"]
5123
+ model_id: hash.key?(:model_id) ? hash[:model_id] : hash["model_id"],
5124
+ model_file: hash.key?(:model_file) ? hash[:model_file] : hash["model_file"],
5125
+ additional_files: hash.key?(:additional_files) ? hash[:additional_files] : hash["additional_files"],
5126
+ max_length: hash.key?(:max_length) ? hash[:max_length] : hash["max_length"]
5092
5127
  )
5093
5128
  end
5094
5129
  end
@@ -5110,7 +5145,7 @@ module Xberg
5110
5145
  # @return [self]
5111
5146
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
5112
5147
  def self.from_hash(hash)
5113
- new(name: hash[:name] || hash["name"])
5148
+ new(name: hash.key?(:name) ? hash[:name] : hash["name"])
5114
5149
  end
5115
5150
  end
5116
5151
  end
@@ -5208,7 +5243,7 @@ module Xberg
5208
5243
  # @return [self]
5209
5244
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
5210
5245
  def self.from_hash(hash)
5211
- new(quality_threshold: hash[:quality_threshold] || hash["quality_threshold"])
5246
+ new(quality_threshold: hash.key?(:quality_threshold) ? hash[:quality_threshold] : hash["quality_threshold"])
5212
5247
  end
5213
5248
  end
5214
5249
  ## Skip the classical OCR backend entirely. Every page is sent to the VLM.