Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

baseline api: redefine `inspect` on wrapper objects to help debugging

Sebastian Fiedlschuster9a1ffea9b8c2
diff --git a/app/models/journable/with_historic_attributes.rb b/app/models/journable/with_historic_attributes.rb
index c6fb90fe10d..0ad1dd36c97 100644
--- a/app/models/journable/with_historic_attributes.rb
+++ b/app/models/journable/with_historic_attributes.rb
@@ -196,5 +196,9 @@ class Journable::WithHistoricAttributes < SimpleDelegator
__getobj__.send(:to_ary)
end
+ def inspect
+ __getobj__.inspect.gsub(/#<(.+)>/m, "#<#{self.class.name} \\1>")
+ end
+
class NotImplemented < StandardError; end
end
diff --git a/lib/api/v3/utilities/eager_loading/eager_loading_wrapper.rb b/lib/api/v3/utilities/eager_loading/eager_loading_wrapper.rb
index 4f71ac4b60b..db18d3da9ee 100644
--- a/lib/api/v3/utilities/eager_loading/eager_loading_wrapper.rb
+++ b/lib/api/v3/utilities/eager_loading/eager_loading_wrapper.rb
@@ -40,6 +40,10 @@ module API
__getobj__.send(:to_ary)
end
+ def inspect
+ __getobj__.inspect.gsub(/#<(.+)>/m, "#<#{self.class.name} \\1>")
+ end
+
class << self
def wrap(objects)
objects