What is Nostr?
Bradley Schaefer /
npub1wgg…ackf
2025-02-26 17:02:55

Bradley Schaefer on Nostr: What's your preferred implementation pattern? 1) [a, b, "unknown"].compact.first 2) ...

What's your preferred implementation pattern?

1) [a, b, "unknown"].compact.first

2) [a, b, "unknown"].detect(&:itself)

3) [-> { a }, -> { b }, -> { "unknown" }].lazy.map(&:call).detect(&:itself)

4) a || b || "unknown"

And don't say "it depends" - the stakes are nothing.

#ruby
Author Public Key
npub1wgglexfyz8aaulvxknnmqs2yd95zl6mzkyy3r8n08ez3uqltdfxqvdackf