Last active Oct 21, 2022
Example of Ruby's dynamicism
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
# https://twitter.com/josh_cheek/status/1583584074652082176 | |
def | |
( class | |
class A | |
self | |
end::B < class C; self end | |
self | |
end | |
).something | |
'hello' | |
end | |
A::B.superclass # => C | |
A::B.something # => "hello" | |
RUBY_VERSION # => "3.0.2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment