Module: Wicked::Good

Included in:
Object
Defined in:
lib/wicked.rb

Overview

Got it? Wicked Good!

Instance Method Summary collapse

Instance Method Details

#aint(p = nil) ⇒ Object Also known as: isnt, is_not, notnot

Guarded method negation in the style of andand Returns the logical opposite of the method invoked on the receiver

receiver.aint.method

Traps NoMethodError and returns nil if receiver is nil or the method does not exist on the receiver.

[].aint.empty?
=> false
[].aint.nil?
=> true
it.aint.broken?
=> false

Don’t be a doofus, use this wisely, on boolean methods only if you know what’s good for you.



40
41
42
# File 'lib/wicked.rb', line 40

def aint (p = nil)
  NotReturningMe.new(self) 
end