Class: Rex::Socket::Range
- Inherits:
-
Object
- Object
- Rex::Socket::Range
- Defined in:
- lib/rex/socket/range_walker.rb
Overview
A range of IP addresses
Instance Attribute Summary collapse
- #options ⇒ Hash
-
#start ⇒ Fixnum
The first address in this range, as a number.
-
#stop ⇒ Fixnum
The last address in this range, as a number.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compare attributes with
other. -
#initialize(start = nil, stop = nil, options = nil) ⇒ Range
constructor
A new instance of Range.
-
#ipv6? ⇒ Boolean
Whether this Range contains IPv6 or IPv4 addresses.
-
#length ⇒ Fixnum
(also: #count)
The number of addresses in this Range.
Constructor Details
#initialize(start = nil, stop = nil, options = nil) ⇒ Range
Returns a new instance of Range.
464 465 466 467 468 |
# File 'lib/rex/socket/range_walker.rb', line 464 def initialize(start=nil, stop=nil, =nil) @start = start @stop = stop @options = end |
Instance Attribute Details
#options ⇒ Hash
457 458 459 |
# File 'lib/rex/socket/range_walker.rb', line 457 def @options end |
#start ⇒ Fixnum
The first address in this range, as a number
450 451 452 |
# File 'lib/rex/socket/range_walker.rb', line 450 def start @start end |
#stop ⇒ Fixnum
The last address in this range, as a number
454 455 456 |
# File 'lib/rex/socket/range_walker.rb', line 454 def stop @stop end |
Instance Method Details
#==(other) ⇒ Boolean
Compare attributes with other
473 474 475 |
# File 'lib/rex/socket/range_walker.rb', line 473 def ==(other) (other.start == start && other.stop == stop && other.ipv6? == ipv6? && other. == ) end |
#ipv6? ⇒ Boolean
Whether this Range contains IPv6 or IPv4 addresses
486 487 488 |
# File 'lib/rex/socket/range_walker.rb', line 486 def ipv6? [:ipv6] end |
#length ⇒ Fixnum Also known as: count
The number of addresses in this Range
479 480 481 |
# File 'lib/rex/socket/range_walker.rb', line 479 def length stop - start + 1 end |