Sha256: d2130294ad63dadec39cecffbf24ec29197e16e208c59556949a4e6eb34649aa

Contents?: true

Size: 979 Bytes

Versions: 15

Compression:

Stored size: 979 Bytes

Contents

#!/usr/bin/env ruby

#---
# Copyright 2003, 2004, 2005, 2006, 2007 by Jim Weirich (jim@weirichhouse.org).
# 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 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

15 entries across 15 versions & 2 rubygems

Version Path
flexmock-0.8.11 lib/flexmock/undefined.rb
flexmock-0.8.10 lib/flexmock/undefined.rb
flexmock-0.8.9 lib/flexmock/undefined.rb
flexmock-0.8.8 lib/flexmock/undefined.rb
flexmock-0.8.7 lib/flexmock/undefined.rb
flexmock-0.8.0 lib/flexmock/undefined.rb
flexmock-0.8.1 lib/flexmock/undefined.rb
flexmock-0.8.6 lib/flexmock/undefined.rb
flexmock-0.8.5 lib/flexmock/undefined.rb
flexmock-0.8.2 lib/flexmock/undefined.rb
flexmock-0.8.3 lib/flexmock/undefined.rb
flexmock-0.8.4 lib/flexmock/undefined.rb
mack-0.8.2 lib/gems/flexmock-0.8.3/lib/flexmock/undefined.rb
mack-0.8.3 lib/gems/flexmock-0.8.3/lib/flexmock/undefined.rb
mack-0.8.3.1 lib/gems/flexmock-0.8.3/lib/flexmock/undefined.rb