structuredmerge-core 0.2.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.
@@ -0,0 +1,158 @@
1
+ # This file is auto-generated by alef — DO NOT EDIT.
2
+ # alef:hash:f019b2dce2facd757e39b0974819a4eef8e6ba43480123955d6bb3b446270eab
3
+ # To regenerate: alef generate
4
+ # To verify freshness: alef verify
5
+ # frozen_string_literal: true
6
+
7
+ require "json"
8
+ require "sorbet-runtime"
9
+ require "rbconfig"
10
+
11
+ extension_name = "structuredmerge_core_rb"
12
+ # Ruby may expose more than one shared-library extension via DLEXT/DLEXT2.
13
+ dlexts = [RbConfig::CONFIG["DLEXT"], RbConfig::CONFIG["DLEXT2"]].compact.uniq
14
+ ruby_abi = RbConfig::CONFIG.fetch("ruby_version")
15
+
16
+ library_candidates = dlexts.flat_map do |dlext|
17
+ [
18
+ File.join(__dir__, "..", extension_name, ruby_abi, "#{extension_name}.#{dlext}"),
19
+ File.join(__dir__, "..", extension_name, ruby_abi, "lib#{extension_name}.#{dlext}"),
20
+ File.join(__dir__, "..", "#{extension_name}.#{dlext}"),
21
+ File.join(__dir__, "..", "lib#{extension_name}.#{dlext}")
22
+ ]
23
+ end
24
+
25
+ expanded_candidates = library_candidates.map { |path| File.expand_path(path) }
26
+ native_extension = expanded_candidates.find { |path| File.file?(path) }
27
+
28
+ unless native_extension
29
+ raise(
30
+ LoadError,
31
+ "cannot find #{extension_name} native extension for Ruby ABI #{ruby_abi}; " \
32
+ "searched: #{expanded_candidates.join(", ")}"
33
+ )
34
+ end
35
+
36
+ require native_extension
37
+
38
+ module StructuredmergeCore
39
+ # The operation discriminator determines the policy type, not argument order.
40
+ module OperationPolicy
41
+ extend T::Helpers
42
+ extend T::Sig
43
+
44
+ interface!
45
+
46
+ # Dispatch from a Hash to the appropriate variant constructor.
47
+ # @param hash [Hash] with discriminator field and variant-specific fields
48
+ # @return [variant_class] an instance of the appropriate variant
49
+ sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.untyped) }
50
+ def self.from_hash(hash)
51
+ discriminator = hash[:operation] || hash["operation"]
52
+ case discriminator
53
+ when "analyze"
54
+ OperationPolicyAnalyze.from_hash(hash)
55
+ when "diff2"
56
+ OperationPolicyDiff2.from_hash(hash)
57
+ when "merge2"
58
+ OperationPolicyMerge2.from_hash(hash)
59
+ when "merge3"
60
+ OperationPolicyMerge3.from_hash(hash)
61
+ else
62
+ raise "Unknown discriminator: #{discriminator}"
63
+ end
64
+ end
65
+ end
66
+ ## Variant OperationPolicyAnalyze of the OperationPolicy sum type.
67
+ OperationPolicyAnalyze = Data.define(:value) do
68
+ include OperationPolicy
69
+ extend T::Sig
70
+
71
+ # @return [AnalyzePolicy]
72
+ sig { returns(AnalyzePolicy) }
73
+ def value = Data.instance_method(:to_h).bind_call(self).fetch(:value)
74
+ sig { returns(T::Boolean) }
75
+ def analyze? = true
76
+ sig { returns(T::Boolean) }
77
+ def diff2? = false
78
+ sig { returns(T::Boolean) }
79
+ def merge2? = false
80
+ sig { returns(T::Boolean) }
81
+ def merge3? = false
82
+ # @param hash [Hash] deserialized from the native extension
83
+ # @return [self]
84
+ sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
85
+ def self.from_hash(hash)
86
+ new(value: hash.key?(:policy) ? hash[:policy] : hash["policy"])
87
+ end
88
+ end
89
+ ## Variant OperationPolicyDiff2 of the OperationPolicy sum type.
90
+ OperationPolicyDiff2 = Data.define(:value) do
91
+ include OperationPolicy
92
+ extend T::Sig
93
+
94
+ # @return [DiffPolicy]
95
+ sig { returns(DiffPolicy) }
96
+ def value = Data.instance_method(:to_h).bind_call(self).fetch(:value)
97
+ sig { returns(T::Boolean) }
98
+ def analyze? = false
99
+ sig { returns(T::Boolean) }
100
+ def diff2? = true
101
+ sig { returns(T::Boolean) }
102
+ def merge2? = false
103
+ sig { returns(T::Boolean) }
104
+ def merge3? = false
105
+ # @param hash [Hash] deserialized from the native extension
106
+ # @return [self]
107
+ sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
108
+ def self.from_hash(hash)
109
+ new(value: hash.key?(:policy) ? hash[:policy] : hash["policy"])
110
+ end
111
+ end
112
+ ## Variant OperationPolicyMerge2 of the OperationPolicy sum type.
113
+ OperationPolicyMerge2 = Data.define(:value) do
114
+ include OperationPolicy
115
+ extend T::Sig
116
+
117
+ # @return [DirectionalMergePolicy]
118
+ sig { returns(DirectionalMergePolicy) }
119
+ def value = Data.instance_method(:to_h).bind_call(self).fetch(:value)
120
+ sig { returns(T::Boolean) }
121
+ def analyze? = false
122
+ sig { returns(T::Boolean) }
123
+ def diff2? = false
124
+ sig { returns(T::Boolean) }
125
+ def merge2? = true
126
+ sig { returns(T::Boolean) }
127
+ def merge3? = false
128
+ # @param hash [Hash] deserialized from the native extension
129
+ # @return [self]
130
+ sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
131
+ def self.from_hash(hash)
132
+ new(value: hash.key?(:policy) ? hash[:policy] : hash["policy"])
133
+ end
134
+ end
135
+ ## Variant OperationPolicyMerge3 of the OperationPolicy sum type.
136
+ OperationPolicyMerge3 = Data.define(:value) do
137
+ include OperationPolicy
138
+ extend T::Sig
139
+
140
+ # @return [ThreeWayMergePolicy]
141
+ sig { returns(ThreeWayMergePolicy) }
142
+ def value = Data.instance_method(:to_h).bind_call(self).fetch(:value)
143
+ sig { returns(T::Boolean) }
144
+ def analyze? = false
145
+ sig { returns(T::Boolean) }
146
+ def diff2? = false
147
+ sig { returns(T::Boolean) }
148
+ def merge2? = false
149
+ sig { returns(T::Boolean) }
150
+ def merge3? = true
151
+ # @param hash [Hash] deserialized from the native extension
152
+ # @return [self]
153
+ sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
154
+ def self.from_hash(hash)
155
+ new(value: hash.key?(:policy) ? hash[:policy] : hash["policy"])
156
+ end
157
+ end
158
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StructuredmergeCore
4
+ # Version namespace for this gem.
5
+ module Version
6
+ # Current gem version.
7
+ VERSION = "0.2.2"
8
+ end
9
+ # Current gem version exposed at the traditional constant location.
10
+ # Traditional Constant Location
11
+ VERSION = Version::VERSION
12
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "version_gem"
4
+
5
+ require_relative "version"
6
+
7
+ StructuredmergeCore::Version.class_eval do
8
+ extend(VersionGem::Basic)
9
+ end
@@ -0,0 +1,21 @@
1
+ # This file is auto-generated by alef — DO NOT EDIT.
2
+ # alef:hash:d6890618b5f310d7f56c1ea6cdc7e5a9ddccedf868fdce179a289ead622d5808
3
+ # To regenerate: alef generate
4
+ # To verify freshness: alef verify
5
+ # frozen_string_literal: true
6
+
7
+ require_relative "structuredmerge_core/native"
8
+ require_relative "structuredmerge_core/version"
9
+
10
+ # Top-level namespace for the StructuredmergeCore Ruby binding.
11
+ #
12
+ # All type and function symbols are re-exported from the native extension
13
+ # loaded via `require_relative "structuredmerge_core/native"`. See
14
+ # {file:README.md} for usage examples and the upstream documentation
15
+ # for the full API reference.
16
+ module StructuredmergeCore
17
+ # Re-export all types and functions from native extension
18
+ end
19
+
20
+ # Keep generated types under StructuredmergeCore. Publishing generated constants
21
+ # into Object makes generic names collide with unrelated Ruby libraries.
@@ -0,0 +1,5 @@
1
+ module StructuredmergeCore
2
+ module Version
3
+ VERSION: String
4
+ end
5
+ end