Module: AwesomePrint::IPAddress

Defined in:
lib/biosphere/node.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



65
66
67
68
# File 'lib/biosphere/node.rb', line 65

def self.included(base)
    base.send :alias_method, :cast_without_ipaddress, :cast
    base.send :alias_method, :cast, :cast_with_ipaddress
end

Instance Method Details

#awesome_ipaddress_instance(object) ⇒ Object



78
79
80
# File 'lib/biosphere/node.rb', line 78

def awesome_ipaddress_instance(object)
    "#{object.class}(#{object.to_string})"
end

#cast_with_ipaddress(object, type) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/biosphere/node.rb', line 70

def cast_with_ipaddress(object, type)
    cast = cast_without_ipaddress(object, type)
    if (defined?(::IPAddress)) && (object.is_a?(::IPAddress))
        cast = :ipaddress_instance
    end
    cast
end