Skip to content

Instantly share code, notes, and snippets.

/set_syntax.rb Secret

Created January 11, 2016 22:11
Show Gist options
  • Save anonymous/5e1953c1c1410b2a9a9d to your computer and use it in GitHub Desktop.
Save anonymous/5e1953c1c1410b2a9a9d to your computer and use it in GitHub Desktop.
class MyHash
def initialize
end # initialize
def []=(key, value, opt: nil)
puts key
puts value
puts opt
end # []=
end # MyHash
h = MyHash.new
h[:hello] = 5, :opt => true
# ./test.rb:12: syntax error, unexpected =>, expecting end-of-input
# h[:hello] = 5, :opt => true
# ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment