Skip to content

has_attr

Description

has_attr returns true if the given attribute of an instance has a non-null value, and false otherwise (including when the attribute is missing or has not been provided).

Example

p is Person where has_attr(self, 'age')

This declaration will only match people that have a property age defined.