Class: Dry::Data::Safe

Inherits:
Object
  • Object
show all
Includes:
Decorator, TypeBuilder
Defined in:
lib/dry/data/safe.rb

Instance Attribute Summary

Attributes included from Decorator

#options, #type

Instance Method Summary collapse

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