Class: Babushka::IP
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) bytes
readonly
Returns the value of attribute bytes.
Instance Method Summary (collapse)
- - (Object) ==(other)
-
- (IP) initialize(input)
constructor
A new instance of IP.
- - (Object) next
- - (Object) prev
- - (Object) to_s
-
- (Boolean) valid?
Returns whether this IP should be considered a valid one for a client to be using.
Constructor Details
- (IP) initialize(input)
A new instance of IP
5 6 7 |
# File 'lib/babushka/ip.rb', line 5 def initialize input @bytes = sanitize input end |
Instance Attribute Details
- (Object) bytes (readonly)
Returns the value of attribute bytes
3 4 5 |
# File 'lib/babushka/ip.rb', line 3 def bytes @bytes end |
Instance Method Details
- (Object) ==(other)
13 14 15 |
# File 'lib/babushka/ip.rb', line 13 def == other bytes == other.bytes end |
- (Object) next
22 23 24 |
# File 'lib/babushka/ip.rb', line 22 def next offset_by(1) end |
- (Object) prev
26 27 28 |
# File 'lib/babushka/ip.rb', line 26 def prev offset_by(-1) end |
- (Object) to_s
9 10 11 |
# File 'lib/babushka/ip.rb', line 9 def to_s bytes.join '.' end |
- (Boolean) valid?
Returns whether this IP should be considered a valid one for a client to be using.
18 19 20 |
# File 'lib/babushka/ip.rb', line 18 def valid? [:public, :private, :loopback].include? describe end |