123456789_123456789_123456789_123456789_123456789_

Class: IPAddr

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: activesupport/lib/active_support/core_ext/object/json.rb

Overview

Use #as_json from the IPAddr gem if the version is 1.2.7 or higher.

Instance Method Summary

Instance Method Details

#as_json(options = nil)

[ GitHub ]

  
# File 'activesupport/lib/active_support/core_ext/object/json.rb', line 245

def as_json(options = nil)
  if ipv4? && prefix == 32
    to_s
  elsif ipv6? && prefix == 128
    to_s
  else
    "#{self}/#{prefix}"
  end
end