Class: IPAddr
- Defined in:
- activesupport/lib/active_support/core_ext/object/json.rb
Overview
Use ‘IPAddr#as_json` from the IPAddr gem if the version is 1.2.7 or higher.
Instance Method Summary collapse
-
#as_json(options = nil) ⇒ Object
:nodoc:.
Instance Method Details
#as_json(options = nil) ⇒ Object
:nodoc:
245 246 247 248 249 250 251 252 253 |
# File 'activesupport/lib/active_support/core_ext/object/json.rb', line 245 def as_json( = nil) if ipv4? && prefix == 32 to_s elsif ipv6? && prefix == 128 to_s else "#{self}/#{prefix}" end end |