なるようになるブログ

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

rails commit log流し読み(2018/12/21)

2018/12/21分のコミットです。

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

activerecord/CHANGELOG.md


Remove remaining tests for Hash#transform_keys and Hash#transform_keys!

activesupport/test/core_ext/hash_ext_test.rbの修正です。

Use native Array#append, Array#prepend, Hash#transform_keys, and Hash#transform_keys!で削除したHas#transform_keysHash#transform_keys!メソッドに関するテストが残っていたのを削除しています。


Module#{define_method,alias_method,undef_method,remove_method} become public since Ruby 2.5

Module#define_methodModule#alias_methodModule#undef_methodModule#remove_methodを使用するのにsendを使用していたのを、メソッドを直接呼び出すよう修正しています。Ruby 2.5からpublicメソッドになった為。


Follow up #34754

Require Ruby 2.5 for Rails 6.のフォローアップとして、先の対応で対応されたメソッドをguideから削除、関連するテストを削除等を行っています。


Module#{attr,attr_accessor,attr_reader,attr_writer} become public since Ruby 2.5

Module#attrModule#attr_accessorModule#attr_readerModule#attr_writerを使用するのにsendを使用していたのを、メソッドを直接呼び出すよう修正しています。Ruby 2.5からpublicメソッドになった為。


Enable Style/RedundantBegin cop to avoid newly adding redundant begin block

Layout/SpaceAfterSemicolon copを追加、及び、各ファイルにcopを適応しています。

Ruby 2.5からdo / end block内でもrescue / else /ensureがbegin無しで書けるようになっている為、不要になったbeginが大量に削除されています。


Fix integer regex deprecation warnings for Ruby 2.6.0 (#34728)

actionview/lib/action_view/helpers/text_helper.rbactionview/test/template/form_options_helper_test.rbの修正です。

Action ViewでObject#=~に関するwarningが出ている箇所があったのを修正しています。


Add test for travel_to with time zone

activesupport/test/time_travel_test.rbの修正です。

Time.zoneが設定されている環境でtravel_toを使用した場合のテストを追加しています。

Ruby 2.6で、Time.zoneが設定されいる場合にtravel_toが正しく動作しないという問題があり、その確認の為にテストを追加しています。


Use BigDecimal provided methods to convert String to BigDecimal

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

ActiveSupport::XmlMiniでStringをBigDecimalを変換するのにBigDecimalを使用していたのを、String#to_dを使用するよう修正しています。

BigDecimalだと不正な値が指定された場合に例外がraiseされる、しかし、ここでは例外をraiseしたくない為、不正な値を指定も例外がraiseされないString#to_dを使用するようにしています。


Clarify the :to parameter of delegate

activesupport/lib/active_support/core_ext/module/delegation.rbのdocの修正です。

Module#delegateメソッドのdoc内、:toオプションについて説明している箇所に、指定する値はターゲットオブジェクトの名前である(ターゲットオブジェクト自身ではない)旨説明を追加しています。


Merge pull request #33822 from y-yagi/do_not_check_parents_dor_directories

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

ActiveSupport::EventedFileUpdateCheckerが、指定されたディレクトリが存在しない場合に、その対象の親ディレクトリをファイルシステムイベントの監視対象にしていたのを監視対象にしないよう修正しています。

ディレクトリを監視対象にいれてしまうと、node_modulesのような本来監視対象にすべきじゃないディレクトリまで監視対象になってしまう為。代わりに、更新チェック時に対象のディレクトリが新規に作成されていないかどうをチェックするようにしています。


Merge pull request #34742 from kamipo/row_format_dynamic_by_default

activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rbの修正です。

MySQL adapterでtable作成時にデフォルトでROW_FORMAT=DYNAMICオプションを指定するよう修正しています。

utf8mb4 + varchar(255) のようなカラムに対してindexを貼る際に必要(データ長の問題により)な為。


Add missing require for String#to_d

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

bigdecimal/utilのrequireが不足していたのを追加しています。


Fixes warning: mismatched indentations at 'rescue' with 'def' at 15.

activesupport/test/core_ext/load_error_test.rbの修正です。

warning: mismatched indentationsのwarningが出ている箇所があったのを修正しています。