Sha256: 07d40525ec995a81154cc27518db716a616fdcf59559b557f6c3b73a5f87096b

Contents?: true

Size: 922 Bytes

Versions: 7

Compression:

Stored size: 922 Bytes

Contents

module Nmap
  #
  # Base class for all Sequence classes.
  #
  # @since 0.5.0
  #
  class Sequence

    #
    # Creates a new sequence object.
    #
    # @param [Nokogiri::XML::Node] node
    #   The node that contains the sequence information.
    #
    # @since 0.5.0
    #
    def initialize(node)
      @node = node
    end

    #
    # The description of the sequence.
    #
    # @return [String]
    #   The sequence class from nmap.
    # 
    # @since 0.5.0
    #
    def description
      @description ||= @node['class']
    end

    #
    # The values within the sequence.
    #
    # @return [Array<Numeric>]
    #   A sample of sequence numbers taken by nmap.
    #
    # @since 0.5.0
    #
    def values
      @values ||= if @node['values']
                    @node['values'].split(',').map { |value| value.to_i(16) }
                  else
                    []
                  end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ruby-nmap-0.10.0 lib/nmap/sequence.rb
ruby-nmap-0.9.3 lib/nmap/sequence.rb
ruby-nmap-0.9.2 lib/nmap/sequence.rb
ruby-nmap-0.9.1 lib/nmap/sequence.rb
ruby-nmap-0.9.0 lib/nmap/sequence.rb
ruby-nmap-0.8.0 lib/nmap/sequence.rb
ruby-nmap-0.7.0 lib/nmap/sequence.rb