なるようになるブログ

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

rails commit log流し読み(2016/06/25)

2016/06/25分のコミットです。

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

activesupport/CHANGELOG.md


Revert "[ci skip] better docs for ActiveRecord::AttributeSet::YAMLEncoder#decode"

ActiveRecord::AttributeSet::YAMLEncoder#decode / ActiveRecord::AttributeSet::YAMLEncoder#decodeメソッドにdocを追加した、[ci skip] better docs for ActiveRecord::AttributeSet::YAMLEncoder#decode · rails/rails@7ea502aをrevertしています。

ActiveRecord::AttributeSet::YAMLEncoderは内部向けクラスであり、public APIでは無い為、とのことです。


nodoc ActiveRecord::AttributeSet::YAMLEncoder

activerecord/lib/active_record/attribute_set/yaml_encoder.rbのdocの修正です。

というわけで、 ActiveRecord::AttributeSet::YAMLEncoderクラスに:nodoc:を設定しています。


[ci skip] Add link to method referenced in ActiveSupport::PerThreadRegistry

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

ActiveSupport::PerThreadRegistry moduleのdco内にあるthread_mattr_accessorに、該当のAPI docへのリンクを追加しています。


Update grammar for config.enable_dependency_loading docs

rails guideのConfiguring Rails Applicationsの修正です。

config.enable_dependency_loadingについての説明の言い回しを修正しています。


Merge pull request #25287 from marekkirejczyk/fix_25267

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

select_yearメソッドにinclude_positionオプションを指定した場合に正しく動作していないバグがあったのを修正しています。


make as option work with get parameters

actionpack/lib/action_dispatch/testing/integration.rbの修正です。

ActionDispatch::Integration moduleのgetメソッド + asオプションを指定した場合に、URIの生成が正しく行わないバグがあったのを修正しています。


Merge pull request #23011 from arnvald/bugfix/correctly_parse_date

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

ActiveSupport::JSON.decodeメソッドにタイムゾーンの指定のない日時の値を渡した際に、タイムゾーンUTCとして扱われていたのを、Railsアプリに指定したtimezoneの値で扱われるよう修正しています。

ActiveSupport.parse_json_times = true
Rails.application.config.time_zone  # => Tokyo

# before
ActiveSupport::JSON.decode(%({"a": "2007-01-01 01:12:34"}))
# => {"a"=>"2007-01-01 01:12:34"}

# after
ActiveSupport::JSON.decode(%({"a": "2007-01-01 01:12:34"}))
# => {"a"=>Mon, 01 Jan 2007 01:12:34 JST +09:00}

Simplify as passed check.

actionpack/lib/action_dispatch/testing/integration.rbの修正です。

asオプションがnilかどうかのチェックに!as.nil?を使用していたのを、単純にas`の値を見るよう修正しています。


Extract method to share path expansion logic.

actionpack/lib/action_dispatch/testing/integration.rbの修正です。

同じURIのpathを生成する処理が複数の箇所で行われていたので、メソッドに切り出しています。


Merge pull request #25350 from tricknotes/uri-generic-as-json

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

URI::Genericクラスにas_jsonメソッドを追加しています。

# before

URI.parse('http://example.com').as_json
# => {"scheme"=>"http",
# "user"=>nil,
# "password"=>nil,
# "host"=>"example.com",
# "port"=>80,
# "path"=>"",
# "query"=>nil,
# "opaque"=>nil,
# "fragment"=>nil,
# "parser"=>
#  {"regexp"=>
#    {"SCHEME"=>"(?-mix:\\A[A-Za-z][A-Za-z0-9+\\-.]*\\z)",
#     "USERINFO"=>"(?-mix:\\A(?:%\\h\\h|[!$&-.0-;=A-Z_a-z~])*\\z)",
#     "HOST"=>
#      "(?-mix:\\A(?:(?<IP-literal>\\[(?:(?<IPv6address>(?:\\h{1,4}:){6}(?<ls32>\\h{1,4}:\\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5]|\\d)\\.\\g<dec-octet>\\.\\g<dec-octet>\\.\\g<dec-octet>))|::(?:\\h{1,4}:){5}\\g<ls32>|\\h{,4}::(?:\\h{1,4}:){4}\\g<ls32>|(?:(?:\\h{1,4}:)?\\h{1,4})?::(?:\\h{1,4}:){3}\\g<ls32>|(?:(?:\\h{1,4}:){,2}\\h{1,4})?::(?:\\h{1,4}:){2}\\g<ls32>|(?:(?:\\h{1,4}:){,3}\\h{1,4})?::\\h{1,4}:\\g<ls32>|(?:(?:\\h{1,4}:){,4}\\h{1,4})?::\\g<ls32>|(?:(?:\\h{1,4}:){,5}\\h{1,4})?::\\h{1,4}|(?:(?:\\h{1,4}:){,6}\\h{1,4})?::)|(?<IPvFuture>v\\h+\\.[!$&-.0-;=A-Z_a-z~]+))\\])|\\g<IPv4address>|(?<reg-name>(?:%\\h\\h|[!$&-.0-9;=A-Z_a-z~])*))\\z)",
#     "ABS_PATH"=>"(?-mix:\\A\\/(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~])*(?:\\/(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~])*)*\\z)",
#     "REL_PATH"=>"(?-mix:\\A(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~])+(?:\\/(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~])*)*\\z)",
#     "QUERY"=>"(?-mix:\\A(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~\\/?])*\\z)",
#     "FRAGMENT"=>"(?-mix:\\A(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~\\/?])*\\z)",
#     "OPAQUE"=>"(?-mix:\\A(?:[^\\/].*)?\\z)",
#     "PORT"=>"(?-mix:\\A[\\x09\\x0a\\x0c\\x0d ]*\\d*[\\x09\\x0a\\x0c\\x0d ]*\\z)"}}}


# after

URI.parse('http://example.com').as_json
# => "http://example.com"

Tiny documentation fixes [ci skip]

activemodel/lib/active_model/errors.rbのdoc及び guides/source/5_0_release_notes.mdの修正です。

不要なスペースやタイポの修正をまとめて行っています。