Created
May 17, 2017 22:05
-
-
Save partkyle/09f6a4e051495fab70eaae1b2ea548c3 to your computer and use it in GitHub Desktop.
Tacos please.
This file contains hidden or 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 tacos? | |
true | |
end | |
end | |
res = 1.tacos? | |
puts "1.tacos? => #{res}" | |
res = 2.tacos? | |
puts "2.tacos? => #{res}" | |
res = [1,2,3].tacos? | |
puts "[1,2,3].tacos? => #{res}" | |
res = [1,2,3].map(&:tacos?) | |
puts "[1,2,3].map(&:tacos?) => #{res}" | |
# and my favorite | |
res = nil.tacos? | |
puts "nil.tacos? => #{res}" |
This file contains hidden or 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
1.tacos? => true | |
2.tacos? => true | |
[1,2,3].tacos? => true | |
[1,2,3].map(&:tacos?) => [true, true, true] | |
nil.tacos? => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment