From b20ac9a1d3c6a268f5b1987f123cbc37d2785deb Mon Sep 17 00:00:00 2001 From: Jonathan Hefner Date: Wed, 11 Nov 2020 16:03:02 -0600 Subject: [PATCH] Document Regexp#multiline? [ci-skip] `Regexp#multiline?` has been publicized in the Active Support Core Extensions guide for a while now. This commit adds matching API docs. --- activesupport/lib/active_support/core_ext/regexp.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/core_ext/regexp.rb b/activesupport/lib/active_support/core_ext/regexp.rb index d92943c7ae..15534ff52f 100644 --- a/activesupport/lib/active_support/core_ext/regexp.rb +++ b/activesupport/lib/active_support/core_ext/regexp.rb @@ -1,6 +1,13 @@ # frozen_string_literal: true -class Regexp #:nodoc: +class Regexp + # Returns +true+ if the regexp has the multiline flag set. + # + # (/./).multiline? # => false + # (/./m).multiline? # => true + # + # Regexp.new(".").multiline? # => false + # Regexp.new(".", Regexp::MULTILINE).multiline? # => true def multiline? options & MULTILINE == MULTILINE end