diff --git a/src/ruby_supportlib/phusion_passenger/utils/json.rb b/src/ruby_supportlib/phusion_passenger/utils/json.rb index 95fd892276..a76c8c2529 100644 --- a/src/ruby_supportlib/phusion_passenger/utils/json.rb +++ b/src/ruby_supportlib/phusion_passenger/utils/json.rb @@ -151,7 +151,7 @@ def generate(obj) private def generate_type(obj) - type = obj.is_a?(Numeric) ? :Numeric : obj.class.name + type = obj.is_a?(Numeric) ? :Numeric : obj.class.name.split('::').last begin send(:"generate_#{type}", obj) rescue NoMethodError; raise ArgumentError, "can't serialize #{type}" end @@ -170,6 +170,10 @@ def generate_String(str) quote str.gsub(/[\r\n\f\t\b"\\]/) { "\\#{ESC_MAP[$&]}"} end + def generate_VersionComparer(vc) + generate_String(vc) + end + def generate_simple(obj) obj.inspect end alias generate_Numeric generate_simple alias generate_TrueClass generate_simple