Skip to content

Commit

Permalink
Prevent self-autoloading
Browse files Browse the repository at this point in the history
  • Loading branch information
flash-gordon committed Dec 15, 2019
1 parent 11fd22c commit 6c5405a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions lib/dry/struct/class_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,12 @@ def build_type(name, type, &block)
end
end
private :build_type

# @api private
# @return [Boolean]
def value?
false
end
end
end
end
6 changes: 1 addition & 5 deletions lib/dry/struct/struct_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ def parent(type)
end

def default_superclass
if defined? ::Dry::Struct::Value
struct < Value ? Value : Struct
else
Struct
end
struct.value? ? Value : Struct
end

def const_name(type, attr_name)
Expand Down
6 changes: 6 additions & 0 deletions lib/dry/struct/value.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ class Value < self
def self.new(*)
::IceNine.deep_freeze(super)
end

# @api private
# @return [Boolean]
def self.value?
true
end
end

deprecate_constant :Value
Expand Down

0 comments on commit 6c5405a

Please sign in to comment.