From d41d881cf8af8cb8b6cb89b87a351585ee46063c Mon Sep 17 00:00:00 2001 From: Szymon Szukalski Date: Fri, 25 Oct 2024 09:44:09 +1100 Subject: Move NilPerson to own file --- lib/nil_person.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/nil_person.rb (limited to 'lib/nil_person.rb') 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 -- cgit v1.2.3