Sha256: a87b891398f68dfc74086c311f5f01620c552ebe51252ec2bce377fa7029974a

Contents?: true

Size: 540 Bytes

Versions: 2

Compression:

Stored size: 540 Bytes

Contents

# TODO: This needs to be imporved. See KO project for
# better implementation.

module AE

  #
  module Okay

    #
    def check(msg=nil, &block)
      if block.arity == 0
        @__c__ = nil
        assert(block.call, msg)
      else
        @__c__ = [block, msg]
      end
    end

    #
    def ok(*args)
      block, msg = *@__c__
      assert(block.call(*args), msg)
    end

    #
    def no(*args)
      block, msg = *@__c__
      refute(block.call(*args), msg)
    end

  end

end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ae-1.7.4 lib/ae/ok.rb
ae-1.7.3 lib/ae/ok.rb