Skip to content

Commit

Permalink
Allow delegated drop methods to be mutable.
Browse files Browse the repository at this point in the history
  • Loading branch information
benbalter committed Aug 30, 2017
1 parent d36d1af commit 7a97ed0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/jekyll-github-metadata/metadata_drop.rb
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/site_github_munger_spec.rb
Expand Up @@ -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

Expand Down

0 comments on commit 7a97ed0

Please sign in to comment.