Module: Dry::Tuple::ClassInterface

Includes:
Core::ClassAttributes, ClassDecorator, Dry::Types::Builder, Dry::Types::Decorator, Dry::Types::Type
Defined in:
lib/dry/tuple/class_interface.rb

Overview

Universal class interface

Examples:

Usage

class SomeClass
  extend Dry::Tuple::ClassInterface
  tuple [Dry::Types['coercible.integer'], Dry::Types['string']]

  def initialize(a, b)
    @a, @b = a, b
  end
end

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClassDecorator

#call_safe, #call_unsafe, #coerce_tuple, #new_from_tuple

Class Method Details

.extended(base) ⇒ Object

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.



38
39
40
41
# File 'lib/dry/tuple/class_interface.rb', line 38

def self.extended(base)
  base.defines :tuple, coerce: TypeCoercer
  super
end

Instance Method Details

#tuple(input) ⇒ Object #tupleDry::Types::Tuple

Overloads:



# File 'lib/dry/tuple/class_interface.rb', line 30

#typeDry::Types::Tuple

Returns:



28
# File 'lib/dry/tuple/class_interface.rb', line 28

def type = @tuple