From a7e1ec901b26bebaf3c973296f765356909a1d0d Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Wed, 18 Nov 2020 16:13:38 +0530 Subject: [PATCH] Add custom debug strings for Jekyll objects (#8473) Merge pull request 8473 --- lib/jekyll/layout.rb | 5 +++++ lib/jekyll/site.rb | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/lib/jekyll/layout.rb b/lib/jekyll/layout.rb index f62fec08..348b6aed 100644 --- a/lib/jekyll/layout.rb +++ b/lib/jekyll/layout.rb @@ -58,5 +58,10 @@ module Jekyll def process(name) self.ext = File.extname(name) end + + # Returns the object as a debug String. + def inspect + "#<#{self.class} @path=#{@path.inspect}>" + end end end diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 07ab7022..7be4349e 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -442,6 +442,13 @@ module Jekyll @collections_path ||= dir_str.empty? ? source : in_source_dir(dir_str) end + # Public + # + # Returns the object as a debug String. + def inspect + "#<#{self.class} @source=#{@source}>" + end + private def load_theme_configuration(config)