class method
self.new
Ruby on Rails 8.1.2
Since v2.2.3Signature
self.new(string, deprecation: true)
Creates a new Chars instance by wrapping string.
Parameters
-
stringreq -
deprecationkey = true
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 56
def initialize(string, deprecation: true)
if deprecation
ActiveSupport.deprecator.warn(
"ActiveSupport::Multibyte::Chars is deprecated and will be removed in Rails 8.2. " \
"Use normal string methods instead."
)
end
@wrapped_string = string
if string.encoding != Encoding::UTF_8
@wrapped_string = @wrapped_string.dup
@wrapped_string.force_encoding(Encoding::UTF_8)
end
end
Defined in activesupport/lib/active_support/multibyte/chars.rb line 56
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Multibyte::Chars