Add inspect filter
This commit is contained in:
parent
e4975836f4
commit
cfd17b2e7d
|
@ -248,6 +248,15 @@ module Jekyll
|
||||||
end
|
end
|
||||||
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
|
private
|
||||||
def time(input)
|
def time(input)
|
||||||
case input
|
case input
|
||||||
|
|
|
@ -211,5 +211,11 @@ class TestFilters < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue