diff --git a/.gitignore b/.gitignore index 24f54284..6c33f5c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.vscode .byebug_history npm-debug.log manifest.yaml diff --git a/middleman-core/features/incremental_builds.feature b/middleman-core/features/incremental_builds.feature index 0abd9357..5d1c9964 100644 --- a/middleman-core/features/incremental_builds.feature +++ b/middleman-core/features/incremental_builds.feature @@ -577,3 +577,23 @@ Feature: Incremental builds | build/part-two.html | And the file "build/part-one.html" should contain "Part = 4" And the file "build/part-two.html" should contain "Part = 6" + + Scenario: Wrapped collection methods, like `select`, should effect downstream methods. + Given an empty app + When a file named "config.rb" with: + """ + """ + When a file named "data/roles.yml" with: + """ + - title: "Job" + salary: 1111 + """ + When a file named "source/roles/data.json.erb" with: + """ + { + "roles": <%= data.roles.select(&:salary).to_json %> + } + """ + Then build the app tracking dependencies + Then there are "1" files which are created + # with depth "1" \ No newline at end of file diff --git a/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb b/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb index 9681249b..2115713b 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb @@ -58,9 +58,9 @@ module Middleman @data.to_s end - def to_json + def to_json(*args) log_access(:__full_access__) - @data.to_a.to_json + @data.to_a.to_json(*args) end private diff --git a/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb b/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb index bfa4ae8f..ccd3641a 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb @@ -27,9 +27,9 @@ module Middleman @data.to_s end - def to_json + def to_json(*args) log_access(:__full_access__) - @data.to_h.to_json + @data.to_h.to_json(*args) end end end