Module: Iba::BlockAssertion

Defined in:
lib/iba.rb

Instance Method Summary collapse

Instance Method Details

#assert(*args, &block) ⇒ Object



255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/iba.rb', line 255

def assert(*args, &block)
  if block
    if yield
      assert_block("true") { true }
    else
      msg = args.empty? ? "" : "#{args.first}.\n"
      ana = Combinator.new(&block).analyse
      assert_block("#{msg}#{ana}.") { false }
    end
  else
    test, msg = *args
    super(test, msg)
  end
end