-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
56 lines (35 loc) · 1.15 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
wicked
======
Wicked Good extensions to Object in the vein of #andand --
First, a couple of aliases for #andand:
*Object#et*
if phone = user.et.number
call(phone)
end
"Et" is Latin for 'and'. This works the same as 'andand', so
it is the same as this, but shorter :)
if user && (phone = user.number)
call(phone)
end
*Object#is*
user.destroy if user.is.revoked?
works the same as
user.destroy if user && user.revoked?
NOTE: be wary of using 'unless' with Object#is or Object#aint -- if
the method doesn't exist on the receiver (user does not respond to revoked?),
both #is and #aint return nil, which can be wicked bad if you don't
grok your logic.
*Object#aint*
user.revoke! if user.aint.revoked?
works the same as
user.revoke! if user && !user.revoked?
For those who aint from the northeast and say 'ant' when they mean their
'aunt', Object#aint is also aliased as:
#is_not
#isnt
#notnot
ONE MORE NOTE: #is and #aint are intended for safely checking boolean methods.
Other uses are expressly not covered under any warranty ;)
COPYRIGHT
=========
Copyright (c) 2009 Jacob Stetser. See LICENSE for details.