Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3990690
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:31:31+00:00 2026-05-20T06:31:31+00:00

I once came across a Ruby library (I’m not sure it was ever packaged

  • 0

I once came across a Ruby library (I’m not sure it was ever packaged as a gem) that allowed you to conveniently apply temporary modifications to Ruby modules. These modifications would only be active within blocks executed within a ‘with’ declaration, like:

with(modifications) do
  [interesting stuff requiring the modifications]
end

It made sure you didn’t need to permanently pollute (core) modules just to get something special done in certain places.

As a specific example of what I want to do: I would like to define an ‘in?’ method on Fixnum, so users of an internal DSL can type:

if value.in? [12, 16, 27, 28]
  [do something interesting]
end

I would wrap the DSL evaluation with a ‘with’ method and I wouldn’t have to pollute Fixnum with this in? method. I know this isn’t too hard to do, but there are probably some dark corners and I had the impression this library was very convenient for this purpose.

Does anyone know the name of this library I am looking for? I seem to recall it was something like ‘plusplus’, but Google doesn’t give me anything.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:31:32+00:00Added an answer on May 20, 2026 at 6:31 am

    I finally came across the answer: the Rewrite gem by raganwald. Unfortunately, it was only a proof of concept and not much has come of it. It works by parsing the Ruby into an AST, mangling the tree and converting the result back to Ruby. This is of course incredibly powerful, but raganwald never got around to introducing general tools to implement specific manglings, and creating a new one is, in his own words, ‘torturous’.

    Implementing the in? method on String would mean searching the AST for the specific S-expression that represents calling in? on a String and converting that to a different method call; probably an in?(string, args) in the local namespace. This soon turns into the problem of static type checking, lest you interpret every in? as a String#in?.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I once came across a MySQL Frontend app that displayed foreign linked rows within
I am trying to develop a plugin for Ruby on Rails and came across
I once came across a validation framework for java, where you wrote one method
I came across this kind of code once in a while - I suspect
Once when I was reading some python docs I came across a reference to
I came across a definition of Perfect matching: a set of edges that touches
As a classic ASP developer about once a year since ASP.NET came out I
I came across this website while looking for help on the internet regarding adj.
I came across this: Writing a compiler using Turbo Pascal I am curious if
I just came across this idiom in some open-source Python, and I choked on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.