RSSAmplifier

Andy Croll · Feb 10, 2026

Use StringInquirer for Readable Predicate Methods

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

You’ve probably seen Rails.env.production? in your codebase to ensure that certain code only runs in production. Instead of having to compare strings, Rails.env == "production" , Rails wraps the string in an ActiveSupport::StringInquirer so you get readable methods like .production? and .development? . Active Support also adds an inquiry method to String so you can use this same pattern in your…

Read on andycroll.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.