mirror of
https://github.com/jekyll/jekyll.git
synced 2026-01-31 01:38:24 -05:00
Merge pull request #2867 from chibicode/add-inspect-filter
This commit is contained in:
@@ -248,6 +248,15 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
# Convert an object into its String representation for debugging
|
||||
#
|
||||
# input - The Object to be converted
|
||||
#
|
||||
# Returns a String representation of the object.
|
||||
def inspect(input)
|
||||
CGI.escapeHTML(input.inspect)
|
||||
end
|
||||
|
||||
private
|
||||
def time(input)
|
||||
case input
|
||||
|
||||
@@ -211,5 +211,11 @@ class TestFilters < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "inspect filter" do
|
||||
should "return a HTML-escaped string representation of an object" do
|
||||
assert_equal "{"<a>"=>1}", @filter.inspect({ "<a>" => 1 })
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user