aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/string/inquiry.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/string/inquiry.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/string/inquiry.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/inquiry.rb b/activesupport/lib/active_support/core_ext/string/inquiry.rb
new file mode 100644
index 0000000000..a796d5fb4f
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/string/inquiry.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require "active_support/string_inquirer"
+
+class String
+ # Wraps the current string in the <tt>ActiveSupport::StringInquirer</tt> class,
+ # which gives you a prettier way to test for equality.
+ #
+ # env = 'production'.inquiry
+ # env.production? # => true
+ # env.development? # => false
+ def inquiry
+ ActiveSupport::StringInquirer.new(self)
+ end
+end