Class: Dry::Types::Optional
- Inherits:
-
Object
- Object
- Dry::Types::Optional
- Defined in:
- lib/dry/types/optional.rb
Instance Attribute Summary
Attributes included from Decorator
Instance Method Summary collapse
- #call(input) ⇒ Object (also: #[])
Methods included from Builder
#constrained, #constructor, #default, #enum, #optional, #safe, #|
Methods included from Decorator
#constructor, #initialize, #respond_to_missing?, #valid?, #with
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Dry::Types::Decorator
Instance Method Details
#call(input) ⇒ Object Also known as: []
10 11 12 |
# File 'lib/dry/types/optional.rb', line 10 def call(input) input.is_a?(Kleisli::Maybe) ? input : Maybe(type[input]) end |