-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
For the methods whose names end with ?, do you maybe want to test for nil rather than test to see if the variable is defined? That is, you want the method to return false if it is defined as nil, right?
For example:
def stream?
defined? @stream
end
Would this be better off as the following?:
def stream?
!! @stream
end
I use !! because I find it helpful for methods ending with ? to return true or false, rather than truthy or falsy values. I feel it is more precise, and produces clearer and more concise output when logging/debugging using expressions like puts "stream? == #{foo.stream?}".
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels