Module: AwesomePrint::IPAddress

Defined in:
lib/biosphere/node.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



108
109
110
111
# File 'lib/biosphere/node.rb', line 108

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



121
122
123
# File 'lib/biosphere/node.rb', line 121

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

#cast_with_ipaddress(object, type) ⇒ Object



113
114
115
116
117
118
119
# File 'lib/biosphere/node.rb', line 113

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