Module: AwesomePrint::IPAddress

Defined in:
lib/biosphere/node.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



61
62
63
64
# File 'lib/biosphere/node.rb', line 61

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



74
75
76
# File 'lib/biosphere/node.rb', line 74

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

#cast_with_ipaddress(object, type) ⇒ Object



66
67
68
69
70
71
72
# File 'lib/biosphere/node.rb', line 66

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