diff options
| author | Cory Gwin @gwincr11 <gwincr11@github.com> | 2017-11-03 21:26:36 -0400 | 
|---|---|---|
| committer | Cory Gwin @gwincr11 <gwincr11@github.com> | 2017-11-17 20:45:43 -0600 | 
| commit | 7b44ffa21efe3b9608254701ffdf44f743b1a324 (patch) | |
| tree | 14425d4c642443336983ffa7c202650131aaac91 /activemodel/lib/active_model/naming.rb | |
| parent | 015239a729d7a247278659e7aa1116a3eddc1dc7 (diff) | |
| download | rails-7b44ffa21efe3b9608254701ffdf44f743b1a324.tar.gz rails-7b44ffa21efe3b9608254701ffdf44f743b1a324.tar.bz2 rails-7b44ffa21efe3b9608254701ffdf44f743b1a324.zip | |
Add support for multiple encodings in String.blank?
Motivation:
  - When strings are encoded with `.encode("UTF-16LE")` `.blank?` throws
  an `Encoding::CompatibilityError` exception.
  - We tested multiple implementation to see what the fastest
  implementation was, rescueing the execption seems to be the fastest
  option we could find.
Related Issues:
  - #28953
Changes:
  - Add a rescue to catch the exception.
  - Added a `Concurrent::Map` to store a cache of encoded regex objects
  for requested encoding types.
  - Use the new `Concurrent::Map` cache to return the correct regex for
  the string being checked.
Diffstat (limited to 'activemodel/lib/active_model/naming.rb')
0 files changed, 0 insertions, 0 deletions
