Class: Dry::Tuple::Struct

Inherits:
Struct
  • Object
show all
Extended by:
ClassInterface
Defined in:
lib/dry/tuple/struct.rb

Overview

Struct abstract subclass extended with Dry::Types::Struct::ClassInterface

Examples:

Usage

class Ambivalent < Dry::Tuple::Struct
  attribute :left, Dry::Types['coercible.string']
  attribute :right, Dry::Types['coercible.string']

  # set key order
  auto_tuple :left, :right
end

class AmbivalentButPrefer < Ambivalent
  attribute :prefer, Dry::Types['coercible.symbol'].enum(:left, :right)
  auto_tuple :prefer
end

Defined Under Namespace

Modules: ClassInterface

Method Summary

Methods included from ClassInterface

auto_tuple, coerce_tuple, extended, try

Methods included from ClassDecorator

#call_safe, #call_unsafe, #coerce_tuple, #new_from_tuple