Sha256: ad9d3838bb178c5bdcdf72e7279be13e63c68475717b7297ecfef900e2ad74cc

Contents?: true

Size: 447 Bytes

Versions: 4

Compression:

Stored size: 447 Bytes

Contents

# frozen_string_literal: true

module Kind
  Undefined = Object.new.tap do |undefined|
    def undefined.inspect
      @inspect ||= 'Undefined'.freeze
    end

    def undefined.to_s
      inspect
    end

    def undefined.clone
      self
    end

    def undefined.dup
      clone
    end

    def undefined.default(value, default)
      return self if value != self

      default.respond_to?(:call) ? default.call : default
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kind-1.5.0 lib/kind/undefined.rb
kind-1.4.0 lib/kind/undefined.rb
kind-1.3.0 lib/kind/undefined.rb
kind-1.2.0 lib/kind/undefined.rb