Sha256: 9a9abaf8e532e5af12d46ca1faf485c955829184ceee34946906d2ac74a2fa9b

Contents?: true

Size: 993 Bytes

Versions: 25

Compression:

Stored size: 993 Bytes

Contents

#!/usr/bin/env ruby

#---
# Copyright 2003-2013 by Jim Weirich (jim.weirich@gmail.com).
# All rights reserved.

# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.
#+++

class FlexMock

  # Undefined is a self preserving undefined object.  The result of
  # any interaction with the undefined object will be the undefined
  # object itself.
  class Undefined
    def method_missing(sym, *args, &block)
      self
    end

    def to_s
      "-UNDEFINED-"
    end

    def inspect
      to_s
    end

    def clone
      self
    end

    def <=>(other)
      self
    end

    def coerce(other)
      [FlexMock.undefined, FlexMock.undefined]
    end
  end

  # Single instance of undefined
  @undefined = Undefined.new

  # Undefined is normally available as FlexMock.undefined
  def self.undefined
    @undefined
  end

  class << Undefined
    private :new
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
flexmock-2.4.2 lib/flexmock/undefined.rb
flexmock-3.0.1 lib/flexmock/undefined.rb
flexmock-2.4.1 lib/flexmock/undefined.rb
flexmock-3.0.0 lib/flexmock/undefined.rb
flexmock-2.4.0 lib/flexmock/undefined.rb
flexmock-2.3.8 lib/flexmock/undefined.rb
flexmock-2.3.6 lib/flexmock/undefined.rb
flexmock-2.3.5 lib/flexmock/undefined.rb
flexmock-2.3.4 lib/flexmock/undefined.rb
flexmock-2.3.3 lib/flexmock/undefined.rb
flexmock-2.3.2 lib/flexmock/undefined.rb
flexmock-2.3.1 lib/flexmock/undefined.rb
flexmock-2.3.0 lib/flexmock/undefined.rb
flexmock-2.2.1 lib/flexmock/undefined.rb
flexmock-2.2.0 lib/flexmock/undefined.rb
flexmock-2.1.0 lib/flexmock/undefined.rb
flexmock-2.0.6 lib/flexmock/undefined.rb
flexmock-2.0.5 lib/flexmock/undefined.rb
flexmock-2.0.4 lib/flexmock/undefined.rb
flexmock-2.0.3 lib/flexmock/undefined.rb