delegate `StaticFile#to_json` to `StaticFile#to_liquid` for a more (#6273)

Merge pull request 6273
This commit is contained in:
Kyle Zhao 2017-08-05 11:01:40 -04:00 committed by jekyllbot
parent 5c2e75823a
commit a99186fe0a
2 changed files with 8 additions and 0 deletions

View File

@ -2,8 +2,12 @@
module Jekyll module Jekyll
class StaticFile class StaticFile
extend Forwardable
attr_reader :relative_path, :extname, :name, :data attr_reader :relative_path, :extname, :name, :data
def_delegator :to_liquid, :to_json, :to_json
class << self class << self
# The cache of last modification times [path] -> mtime. # The cache of last modification times [path] -> mtime.
def mtimes def mtimes

View File

@ -176,5 +176,9 @@ class TestStaticFile < JekyllUnitTest
} }
assert_equal expected, @static_file.to_liquid.to_h assert_equal expected, @static_file.to_liquid.to_h
end end
should "jsonify its liquid drop instead of itself" do
assert_equal @static_file.to_liquid.to_json, @static_file.to_json
end
end end
end end