You can use the simple not flag to validate that. Example
if !@objectname
This will return true if @objectname is nil. You should not use dot operator or a nil value, else it will throw
*** NoMethodError Exception: undefined method `isNil?' for nil:NilClass
An ideal nil check would be like:
!@objectname || @objectname.nil? || @objectname.empty?