Class: Dry::Data::Safe
- Inherits:
-
Object
- Object
- Dry::Data::Safe
- Includes:
- Decorator, TypeBuilder
- Defined in:
- lib/dry/data/safe.rb
Instance Attribute Summary
Attributes included from Decorator
Instance Method Summary collapse
- #call(input) ⇒ Object (also: #[])
Methods included from TypeBuilder
#constrained, #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::Data::Decorator
Instance Method Details
#call(input) ⇒ Object Also known as: []
9 10 11 12 13 14 15 |
# File 'lib/dry/data/safe.rb', line 9 def call(input) if input.is_a?(primitive) type.call(input) else input end end |