Skip to content

Instantly share code, notes, and snippets.

@enebo
Last active March 31, 2020 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enebo/4651572a54cb9c6cefdc6fbd43d1bcde to your computer and use it in GitHub Desktop.
Save enebo/4651572a54cb9c6cefdc6fbd43d1bcde to your computer and use it in GitHub Desktop.
def [](a, &foo)
yield a, "wot???"
nil
end
public :[]
def []=(a, b, &foo)
yield a, b
end
self[1, &proc { |*a| p a }] ||= 2
@headius
Copy link

headius commented Mar 31, 2020

$ rvm ruby-2.6.5 do ruby weird.rb
[1, "wot???"]
[1, 2]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment