Class: Dry::Types::AnyClass
Overview
Any is a nominal type that defines Object as the primitive class
This type is useful in places where you can't be specific about the type and anything is acceptable.
Instance Attribute Summary collapse
- #options ⇒ Hash included from Options readonly private
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**options) ⇒ AnyClass
constructor
private
A new instance of AnyClass.
- #name ⇒ String
- #to_ast(meta: true) ⇒ Array
- #with(**new_options) ⇒ Type
Constructor Details
#initialize(**options) ⇒ AnyClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of AnyClass.
17 18 19 |
# File 'lib/dry/types/any.rb', line 17 def initialize(**) super(::Object, **) end |
Instance Attribute Details
Class Method Details
.name ⇒ Object
12 13 14 |
# File 'lib/dry/types/any.rb', line 12 def self.name "Any" end |
Instance Method Details
#name ⇒ String
24 25 26 |
# File 'lib/dry/types/any.rb', line 24 def name "Any" end |
#to_ast(meta: true) ⇒ Array
40 41 42 |
# File 'lib/dry/types/any.rb', line 40 def to_ast(meta: true) [:any, ? self. : EMPTY_HASH] end |
#with(**new_options) ⇒ Type
33 34 35 |
# File 'lib/dry/types/any.rb', line 33 def with(**) self.class.new(**, meta: @meta, **) end |