Skip to content

Commit

Permalink
Backport static-file-to-json from #6273 to 3.5-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
xrav3nz authored and parkr committed Aug 12, 2017
1 parent 50453d2 commit 27e4f75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/jekyll/static_file.rb
@@ -1,7 +1,11 @@
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
Expand Down
4 changes: 4 additions & 0 deletions test/test_static_file.rb
Expand Up @@ -174,5 +174,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

0 comments on commit 27e4f75

Please sign in to comment.