Sha256: d27443abbecdc27c7b42d9da26932492b4b41ab41aeb48bdadbfdb5102a0dad4

Contents?: true

Size: 552 Bytes

Versions: 6

Compression:

Stored size: 552 Bytes

Contents

# frozen_string_literal: true

require "dry/types/printer"

module Dry
  module Types
    # @api private
    class Printer
      MAPPING[Struct::Sum] = :visit_struct_sum
      MAPPING[Struct::Constructor] = :visit_struct_constructor

      def visit_struct_sum(sum)
        visit_sum_constructors(sum) do |constructors|
          visit_options(EMPTY_HASH, sum.meta) do |opts|
            yield "Struct::Sum<#{constructors}#{opts}>"
          end
        end
      end

      alias_method :visit_struct_constructor, :visit_constructor
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-struct-1.7.0 lib/dry/struct/printer.rb
dry-struct-1.6.0 lib/dry/struct/printer.rb
dry-struct-1.5.2 lib/dry/struct/printer.rb
dry-struct-1.5.1 lib/dry/struct/printer.rb
dry-struct-1.5.0 lib/dry/struct/printer.rb
dry-struct-1.4.0 lib/dry/struct/printer.rb