Did You Know That (in Ruby): NameError::message
While whipping up a tiny pure-Ruby implementation of the standard exception hierarchy for Laser, I came across a simply peculiar class: NameError::message.
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
While whipping up a tiny pure-Ruby implementation of the standard exception hierarchy for Laser, I came across a simply peculiar class: NameError::message.
Comments
Great finding. I’m especially amazed by the way you’re accessing the lower-case constant.
One way to pass arguments to
!without usingsendwould be the following.ErrMessage.!('method: %s receiver: %s', 25, :upcase)Well that was foolish of my to glide past. Thanks for the reminder - updated!
What a peculiar feature; great post.
Post a comment