From 7a97ed09f60bf4afa04924b250757941a48ac58d Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Wed, 30 Aug 2017 14:10:32 -0400 Subject: [PATCH] Allow delegated drop methods to be mutable. See https://github.com/jekyll/jekyll/pull/6338 --- lib/jekyll-github-metadata/metadata_drop.rb | 3 +++ spec/site_github_munger_spec.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/jekyll-github-metadata/metadata_drop.rb b/lib/jekyll-github-metadata/metadata_drop.rb index 76f6535..af5f6bd 100644 --- a/lib/jekyll-github-metadata/metadata_drop.rb +++ b/lib/jekyll-github-metadata/metadata_drop.rb @@ -8,6 +8,9 @@ class MetadataDrop < Jekyll::Drops::Drop mutable true + # See https://github.com/jekyll/jekyll/pull/6338 + alias_method :invoke_drop, :[] + def to_s require "json" JSON.pretty_generate to_h diff --git a/spec/site_github_munger_spec.rb b/spec/site_github_munger_spec.rb index 3d765d8..0de9287 100644 --- a/spec/site_github_munger_spec.rb +++ b/spec/site_github_munger_spec.rb @@ -43,11 +43,11 @@ let(:github_namespace) { { "source" => { "branch" => "foo" } } } it "lets user-specified values override the drop" do - expect(site.config["github"]["source"]["branch"]).to eql("foo") + expect(site.config["github"].invoke_drop("source")["branch"]).to eql("foo") end it "still sets other values" do - expect(site.config["github"]["source"]["path"]).to eql("/") + expect(site.config["github"].invoke_drop("source")["path"]).to eql("/") end end