Drop: hash syntax should use setter method for a property if it's defined

This commit is contained in:
Parker Moore 2016-01-04 12:09:19 -08:00
parent 87978e79f4
commit 06c45df8c3
1 changed files with 3 additions and 1 deletions

View File

@ -62,7 +62,9 @@ module Jekyll
# and the key matches a method in which case it raises a
# DropMutationException.
def []=(key, val)
if self.class.mutable
if respond_to?("#{key}=")
public_send("#{key}=", val)
elsif self.class.mutable
@mutations[key] = val
elsif respond_to? key
raise Errors::DropMutationException, "Key #{key} cannot be set in the drop."