I\'m just breaking into the ruby world and I could use a helping hand.
Suppose b is nil.
b
nil
I\'d like the following code to return n
n
You can use the inline rescue:
x = a.b.c("d").e rescue nil
x will be nil if b is nil.
x
Or, as someone commented in that link, you can use the andand gem (see docs):
x = a.andand.b.andand.c("d").andand.e