From a99186fe0a36dfef004db80249b16c9bd57445f9 Mon Sep 17 00:00:00 2001 From: Kyle Zhao Date: Sat, 5 Aug 2017 11:01:40 -0400 Subject: [PATCH] delegate `StaticFile#to_json` to `StaticFile#to_liquid` for a more (#6273) Merge pull request 6273 --- lib/jekyll/static_file.rb | 4 ++++ test/test_static_file.rb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/jekyll/static_file.rb b/lib/jekyll/static_file.rb index 55f0256c24f..fd537107f56 100644 --- a/lib/jekyll/static_file.rb +++ b/lib/jekyll/static_file.rb @@ -2,8 +2,12 @@ module Jekyll class StaticFile + extend Forwardable + attr_reader :relative_path, :extname, :name, :data + def_delegator :to_liquid, :to_json, :to_json + class << self # The cache of last modification times [path] -> mtime. def mtimes diff --git a/test/test_static_file.rb b/test/test_static_file.rb index edfc9facf0e..f74d8c1a001 100644 --- a/test/test_static_file.rb +++ b/test/test_static_file.rb @@ -176,5 +176,9 @@ def setup_static_file_with_defaults(base, dir, name, defaults) } assert_equal expected, @static_file.to_liquid.to_h 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