Sha256: 47ecfe2db74b6d7d6eccf826ea228834dadded66befa3812f7b07d0b5352aa72

Contents?: true

Size: 447 Bytes

Versions: 4

Compression:

Stored size: 447 Bytes

Contents

# frozen_string_literal: true
class Shoes
  module Swt
    module DisposedProtection
      def real
        return NullObject.new(@real) if @real.disposed?
        @real
      end

      class NullObject < BasicObject
        def initialize(real)
          @real = real
        end

        def respond_to?(method)
          @real.respond_to? method
        end

        def method_missing(_method, *_args)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre12 lib/shoes/swt/disposed_protection.rb
shoes-swt-4.0.0.pre11 lib/shoes/swt/disposed_protection.rb
shoes-swt-4.0.0.pre10 lib/shoes/swt/disposed_protection.rb
shoes-swt-4.0.0.pre9 lib/shoes/swt/disposed_protection.rb