instance method
mode_from
Ruby on Rails 7.1.6
Since v7.1.6 PrivateSignature
mode_from(options)
No documentation comment.
Parameters
-
optionsreq
Source
# File activesupport/lib/active_support/log_subscriber.rb, line 184
def mode_from(options)
if options.is_a?(TrueClass) || options.is_a?(FalseClass)
ActiveSupport.deprecator.warn(<<~MSG.squish)
Bolding log text with a positional boolean is deprecated and will be removed
in Rails 7.2. Use an option hash instead (eg. `color("my text", :red, bold: true)`).
MSG
options = { bold: options }
end
modes = MODES.values_at(*options.compact_blank.keys)
"\e[#{modes.join(";")}m" if modes.any?
end
Defined in activesupport/lib/active_support/log_subscriber.rb line 184
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::LogSubscriber