Last active
January 27, 2023 21:15
-
-
Save revskill10/2e065f6ae753e528e466f7e9702b5b39 to your computer and use it in GitHub Desktop.
Pipeline programming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object | |
def true? | |
return unless self | |
tmp = yield | |
return tmp | |
end | |
def else | |
return yield unless self | |
self | |
end | |
end | |
(1 + 1 == 3).true? { [3,4,5] } | |
.else { [1,2] } | |
.filter{ |item| (item % 2 == 0) } | |
.each { |item| puts "ITEM #{item}" } | |
# print 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment