なるようになるブログ

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

rails commit log流し読み(2014/10/25)

2014/10/25分のコミットです。

CHANGELOGへの追加はありませんでした。


Improved try documentation [ci skip]

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

tryメソッドのexampleの追加、タイポ、グラマーの修正等を行っています。


Include return value in examples added in #17378 [ci skip]

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

先のコミットで追加したexampleについて、実行結果を追加しています。


Revert a change made to the example in 1ac4525

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

先のコミットで追加したexampleで、戻り値がnilだった場合の考慮が足りてなかったモノがあったので、再度修正しています。


Fix typo in "Active Record Basics" guide. [ci skip]

guides/source/active_record_basics.mdの修正です。

タイポ(is -> an)の修正を行っています。


Avoid creating unneeded Hash instance and calling slow Hash#fetch

actionview/lib/action_view/renderer/template_renderer.rbの修正です。

determine_templateメソッドで、引数のチェック処理で不要なHashのインスタンを生成するケースがあったので、それを避ける対応、及びHash#fetchを使用しないよう改善しています。


The code was not up-to-date

guides/source/active_support_core_extensions.mdの修正です。

full_messagesメソッドのexampleが現在のコードとずれていたようで、最新の内容に更新しています。


Avoid creating range objects (take II)

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

toメソッドで、不要なRange Obejectを作成しないようリファクタリングしています。


Reduce object allocation

actionview/lib/action_view/template.rbの修正です。

locals_codeメソッドで、インスタンス生成処理を減らすようリファクタリングしています。

map..joinメソッドを使用していたのを、each_with_objectを使用するよう修正しています。


Reduce object allocation

actionview/lib/action_view/template.rbの修正です。

method_nameメソッドで、インスタンス生成処理を減らすようリファクタリングしています。

-        @method_name ||= "_#{identifier_method_name}__#{@identifier.hash}_#{__id__}".tr('-', "_")
+        @method_name ||= begin
+          m = "_#{identifier_method_name}__#{@identifier.hash}_#{__id__}"
+          m.tr!('-', '_')
+          m
+        end

むう。これで改善になるんですねえ。


instance_eval is evil

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

instance_evalではなく、instance_variable_setを使用するよう修正しています。


fixes circularity check in dependencies

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

load_missing_constantメソッドで、循環読み込みのチェック処理を修正しています。

既に読み込み済みのファイルではなく、今読み込んでいるファイルに対してチェックを行うように修正した、なのかなあ…。


give a better error message for misspelled helpers

actionpack/lib/abstract_controller/helpers.rbの修正です。

helperのロードに失敗した場合に、適切なエラーメッセージを表示されるよう修正しています。