Skip to content

Commit

Permalink
fix json serializing VersionComparer
Browse files Browse the repository at this point in the history
used in `passenger-config system-properties`

fixes #2565
  • Loading branch information
CamJN committed Sep 30, 2024
1 parent 7397933 commit 7d67fbb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ruby_supportlib/phusion_passenger/utils/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7d67fbb

Please sign in to comment.