RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

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!

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.

Comments

Great finding. I’m especially amazed by the way you’re accessing the lower-case constant.

One way to pass arguments to ! without using send would 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

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in