diff options
| author | Szymon Szukalski <szymon@skas.io> | 2024-10-25 09:44:09 +1100 |
|---|---|---|
| committer | Szymon Szukalski <szymon@skas.io> | 2024-10-25 09:44:09 +1100 |
| commit | d41d881cf8af8cb8b6cb89b87a351585ee46063c (patch) | |
| tree | 33587d0ea1d1f48a2ef03c360220acc9cfda3ce4 /lib/nil_person.rb | |
| parent | c8b917b1e0f217bf529918d540c49d07a69dba3e (diff) | |
Move NilPerson to own file
Diffstat (limited to 'lib/nil_person.rb')
| -rw-r--r-- | lib/nil_person.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/nil_person.rb b/lib/nil_person.rb new file mode 100644 index 0000000..30a175f --- /dev/null +++ b/lib/nil_person.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class NilPerson + def name + nil + end + + def father + self + end + + def mother + self + end + + def gender + nil + end + + def ==(other) + other.is_a?(NilPerson) + end + + def eql?(other) + self == other + end + + def to_s + '' + end +end |
