Module: Types

Defined in:
lib/dry_helper.rb

Overview

The following allow you to access types with Types.

email = Types.string.constrained(
  format: /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
)
drinking_age = Types.integer.constrained(gt: 21)

Class Method Summary collapse

Class Method Details

.[](type_key) ⇒ Object

Parameters:

  • String

    The key of the Dry::Type -- see Dry::Types.type_keys



24
25
26
# File 'lib/dry_helper.rb', line 24

def [] (type_key)
  Dry::Types[type_key]
end