Sha256: a5f04bbe646d56ecc938b8f0db6e92e010a0650d3b15bff7d6c69f4f28cce05d

Contents?: true

Size: 895 Bytes

Versions: 1

Compression:

Stored size: 895 Bytes

Contents

#!/usr/bin/env ruby -W:no-experimental
# frozen_string_literal: true

require 'bundler/setup'
require 'sober_swag'
require 'dry-struct'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
module Types
  include Dry.Types()
end

class Bio < Dry::Struct
  attribute :name, Types::String
end

class Person < Dry::Struct
  attribute :name, Types::String
  attribute :age, Types::Integer.constrained(gt: 0).optional | Types::String.optional
  attribute? :mood, Types::String
  attribute :bio, Bio

  attribute :foo do
    attribute :bar, Types::String
    attribute :baz, Types::String.optional
  end
end

class PersonSearch < Dry::Struct
  attribute? :name, Types::String
  attribute? :age, Types::Integer
end


# (If you use this, don't forget to add pry to your Gemfile!)
require "pry"
Pry.start

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sober_swag-0.1.0 bin/console