Sha256: abb9d4f0980c78e9491ed11b888cced649348c5051973d46913a7a77ac563165

Contents?: true

Size: 394 Bytes

Versions: 1

Compression:

Stored size: 394 Bytes

Contents

# frozen_string_literal: true

require 'weakref'
require 'dry/types/compiler'

module Dry
  class Struct
    class Compiler < Types::Compiler
      def visit_struct(node)
        struct, _ = node

        struct.__getobj__
      rescue ::WeakRef::RefError
        if struct.weakref_alive?
          raise
        else
          raise RecycledStructError
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-struct-1.3.0 lib/dry/struct/compiler.rb