Merge pull request #2867 from chibicode/add-inspect-filter
This commit is contained in:
		
						commit
						6928adf501
					
				|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue