Skip to content

Commit 7dd2248

Browse files
committed
Avoid redefining IpAddr#as_json if it already exist
Ref: ruby/ipaddr#77
1 parent 2975a88 commit 7dd2248

File tree

1 file changed

+5
-3
lines changed
  • activesupport/lib/active_support/core_ext/object

1 file changed

+5
-3
lines changed

activesupport/lib/active_support/core_ext/object/json.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,11 @@ def as_json(options = nil)
233233
end
234234
end
235235

236-
class IPAddr # :nodoc:
237-
def as_json(options = nil)
238-
to_s
236+
unless IPAddr.method_defined?(:as_json, false)
237+
class IPAddr # :nodoc:
238+
def as_json(options = nil)
239+
to_s
240+
end
239241
end
240242
end
241243

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy