なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2016/07/22)

2016/07/22分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

activesupport/CHANGELOG.md

activesupport/CHANGELOG.md


Allow MessageEncryptor to take advantage of authenticated encryption modes

activesupport/lib/active_support/message_encryptor.rbの修正です。

ActiveSupport::MessageEncryptorでAEAD(Authenticated Encryption with Associated Data) modeを使用出来るよう対応しています。

参考:Class: OpenSSL::Cipher (Ruby 2.3.0)


define Range#match? if Ruby < 2.4

activesupport/lib/active_support/core_ext/regexp.rbの修正です。

Regexpクラスにmatch?メソッドを追加しています。

Ruby 2.4から正規表現にマッチしたかどうかを確認する為のRegexp#match?が提供されています。これは従来の確認用メソッド(#===#~#match)より高速に動作するようになっています。

で、Rails内部でRuby 2.2 / 2.3でもRegexp#match?が使用出来るようにする為にメソッドを追加しています。因みに同じインターフェイスにする為だけにメソッドを追加しており、今回追加されたRegexp#match?メソッドは高速では無いです。

参考:New Features in Ruby 2.4 - BlockScore Blog


performance boost for String#blank? in Ruby 2.4

activesupport/lib/active_support/core_ext/object/blank.rbの修正です。

String#blank?正規表現のマッチ処理にRegexp#match?を使用するよう修正しています。Ruby 2.4以降であれば高速に動作する為。


the infamous typo only seen in GitHub's diff [ci skip]

activesupport/CHANGELOG.mdの修正です。

Regexp#match?メソッドを追加した対応のエントリーのタイポを修正しています。


revises style

activesupport/lib/active_support/core_ext/regexp.rbの修正です。

Regexp#match?メソッド内の結果を判定する処理で、不要なスペースがあったのを削除しています。

-    !! match(string, pos)
+    !!match(string, pos)

adds require for Regexp#match?

activesupport/lib/active_support/core_ext/object/blank.rbの修正です。

不足していたactive_support/core_ext/regexpのrequireを追加しています。