# File lib/bacon.rb, line 309 309: def be(*args, &block) 310: if args.empty? 311: self 312: else 313: block = args.shift unless block_given? 314: satisfy(*args, &block) 315: end 316: end
# File lib/bacon.rb, line 346 346: def equal(value) self == value end
# File lib/bacon.rb, line 351 351: def flunk(reason="Flunked") 352: raise Bacon::Error.new(:failed, reason) 353: end
# File lib/bacon.rb, line 348 348: def identical_to(value) self.equal? value end
# File lib/bacon.rb, line 347 347: def match(value) self =~ value end
# File lib/bacon.rb, line 336 336: def method_missing(name, *args, &block) 337: name = "#{name}?" if name.to_s =~ /\w[^?]\z/ 338: 339: desc = @negated ? "not " : "" 340: desc << @object.inspect << "." << name.to_s 341: desc << "(" << args.map{|x|x.inspect}.join(", ") << ") failed" 342: 343: satisfy(desc) { |x| x.__send__(name, *args, &block) } 344: end
# File lib/bacon.rb, line 299 299: def not(*args, &block) 300: @negated = !@negated 301: 302: if args.empty? 303: self 304: else 305: be(*args, &block) 306: end 307: end
# File lib/bacon.rb, line 321 321: def satisfy(*args, &block) 322: if args.size == 1 && String === args.first 323: description = args.shift 324: else 325: description = "" 326: end 327: 328: r = yield(@object, *args) 329: if Bacon::Counter[:depth] > 0 330: Bacon::Counter[:requirements] += 1 331: raise Bacon::Error.new(:failed, description) unless @negated ^ r 332: end 333: @negated ^ r ? r : false 334: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.