Maybe
In the last blog post I was writing about the smell of using if statements when a value may be present or not.
In this blog post I’m going to let the code speak by itself.
class Author
include Maybe
def name
just "Mateu"
end
end
author = Author.new
puts author.name
.if{|it| it.include? "a"}
.change{|it| it.upcase}
.or{"I don't know"}