2 ms·
I think this is a normal ruby pattern though. A ? prefix is just a best-practice habit to indicate a method returns a real TrueClass or FalseClass instance. Yo
by graypegg 3y ago
I think this is a normal ruby pattern though. A ? prefix is just a best-practice habit to indicate a method returns a real TrueClass or FalseClass instance.
You’re always running Ruby statements in some scope, so there’s always an object you’re running methods from. That makes your constructor and reflection examples a bit odd for Ruby.
Constructors would be a method on a class, normally the Class instance method #new: Widget.new(x)
Checking if y is a Widget would mean calling a method on that instance, normally the Object instance method #is_a?: y.is_a?(Widget)
I think that’s adequately distinct.
- deleted 3y ago[deleted]