Possible Duplicate:
Is there a clean way to avoid calling a method on nil in a nested params hash?
Is there an equivalent null prevention on chained attributes of groovy in ruby?
Is there any syntactic sugar, in Ruby, that help avoiding "undefined method `xx' for nil:NilClass" without writing this?
if !something.nil? && !something.very.nil? && !something.very.long.nil? && !something.very.long.to.nil? then
if something.very.long.to.write != 0 then
...
end
end
in Groovy I'll do this
if(something?.very?.loong?.to?.write != 0)
Is there an equivalent syntax for Ruby?