Gordon Pedersen
eef53251d1
Starting with Sprites. Still don't quite know my way around Ruby yet, so it's a learning experience.
18 lines
296 B
Ruby
18 lines
296 B
Ruby
# Handy null coalesing operator, taken from
|
|
# https://github.com/kibiz0r/coalesce/blob/bc4389ae8a8bb456cd10ec8a3523df1fc775124f/lib/coalesce.rb
|
|
|
|
class Object
|
|
def _?(x = nil)
|
|
self
|
|
end
|
|
end
|
|
|
|
class NilClass
|
|
def _?(x = nil)
|
|
if block_given?
|
|
yield
|
|
else
|
|
x
|
|
end
|
|
end
|
|
end
|