Sha256: 964f23ae47ac50543ddda0fe9d098fd3344f1ca64f7d00f34b48b962e90dfd50

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

require 'ae/subjunctive'

module AE

  # = Must
  #
  #   "It is not enough to succeed. Others must fail."
  #                           --Gore Vidal (1925 - )
  #
  # THIS IS AN OPTIONAL LIBRARY.
  #
  module Must
    # The #must method is functionaly the same as #should.
    #
    #   4.must == 3  #=> Assertion Error
    #
    #   4.must do
    #     self == 4
    #   end
    #
    def must(*args, &block)
      Assertor.new(self, :backtrace=>caller).be(*args, &block)
    end

    # Designate a negated expectation via a *functor*.
    # Read this as "must not".
    #
    #   4.must! == 4  #=> Assertion Error
    #
    def must!(*args, &block)
      Assertor.new(self, :backtrace=>caller).not.be(*args, &block)
    end

    # Perhaps not literally the counter-term to *must* (rather *will*),
    # it is close enough for our purposes and conveys the appropriate semantics.
    alias_method :wont, :must!

    # Alias for #must! method.
    #alias_method :musnt   , :must!
  end

end

class ::Object #:nodoc:
  include AE::Must
end

# Copyright (c) 2008,2009 Thomas Sawyer

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ae-1.6.1 lib/ae/must.rb
ae-1.6.0 lib/ae/must.rb
ae-1.5.0 lib/ae/must.rb
ae-1.4.0 lib/ae/subjunctive/must.rb
ae-1.3.0 lib/ae/subjunctive/must.rb