Skip to content

Commit 6c5405a

Browse files
committed
Prevent self-autoloading
1 parent 11fd22c commit 6c5405a

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

lib/dry/struct/class_interface.rb

+6
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,12 @@ def build_type(name, type, &block)
426426
end
427427
end
428428
private :build_type
429+
430+
# @api private
431+
# @return [Boolean]
432+
def value?
433+
false
434+
end
429435
end
430436
end
431437
end

lib/dry/struct/struct_builder.rb

+1-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ def parent(type)
4343
end
4444

4545
def default_superclass
46-
if defined? ::Dry::Struct::Value
47-
struct < Value ? Value : Struct
48-
else
49-
Struct
50-
end
46+
struct.value? ? Value : Struct
5147
end
5248

5349
def const_name(type, attr_name)

lib/dry/struct/value.rb

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ class Value < self
2929
def self.new(*)
3030
::IceNine.deep_freeze(super)
3131
end
32+
33+
# @api private
34+
# @return [Boolean]
35+
def self.value?
36+
true
37+
end
3238
end
3339

3440
deprecate_constant :Value

0 commit comments

Comments
 (0)