From ae0a064f3fb9768660b5325e105701faef4e4a10 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Fri, 11 Jan 2019 13:18:49 +0530 Subject: [PATCH] Output correct class name in custom inspect string --- lib/jekyll/collection.rb | 2 +- lib/jekyll/document.rb | 2 +- lib/jekyll/excerpt.rb | 2 +- test/test_excerpt.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/collection.rb b/lib/jekyll/collection.rb index 1ead17b3..88076f61 100644 --- a/lib/jekyll/collection.rb +++ b/lib/jekyll/collection.rb @@ -153,7 +153,7 @@ module Jekyll # # Returns the inspect string def inspect - "#" + "#<#{self.class} @label=#{label} docs=#{docs}>" end # Produce a sanitized label name diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 3cbddd6c..30cecee2 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -295,7 +295,7 @@ module Jekyll # # Returns the inspect string for this document. def inspect - "#" + "#<#{self.class} #{relative_path} collection=#{collection.label}>" end # The string representation for this document. diff --git a/lib/jekyll/excerpt.rb b/lib/jekyll/excerpt.rb index 91fea1c5..ddadfcff 100644 --- a/lib/jekyll/excerpt.rb +++ b/lib/jekyll/excerpt.rb @@ -77,7 +77,7 @@ module Jekyll # Returns the shorthand String identifier of this doc. def inspect - "" + "<#{self.class} id=#{id}>" end def output diff --git a/test/test_excerpt.rb b/test/test_excerpt.rb index dd0acdf7..fbe6f63d 100644 --- a/test/test_excerpt.rb +++ b/test/test_excerpt.rb @@ -69,7 +69,7 @@ class TestExcerpt < JekyllUnitTest context "#inspect" do should "contain the excerpt id as a shorthand string identifier" do - assert_equal @excerpt.inspect, "" + assert_equal @excerpt.inspect, "<#{@excerpt.class} id=#{@excerpt.id}>" end should "return a string" do