lib/nmap/sequence.rb in ruby-nmap-0.6.0 vs lib/nmap/sequence.rb in ruby-nmap-0.7.0

- old
+ new

@@ -10,22 +10,14 @@ # Creates a new sequence object. # # @param [Nokogiri::XML::Node] node # The node that contains the sequence information. # - # @yield [sequence] - # If a block is given, it will passed the newly created sequence. - # - # @yieldparam [Sequence] sequence - # The newly created sequence object. - # # @since 0.5.0 # def initialize(node) @node = node - - yield self if block_given? end # # The description of the sequence. # @@ -33,11 +25,11 @@ # The sequence class from nmap. # # @since 0.5.0 # def description - @node['class'] + @description ||= @node['class'] end # # The values within the sequence. # @@ -45,18 +37,14 @@ # A sample of sequence numbers taken by nmap. # # @since 0.5.0 # def values - unless @values - @values = [] - - if (string = @node['values']) - string.scan(/[^\s,]+/) { |match| @values << match.to_i(16) } - end - end - - return @values + @values ||= if @node['values'] + @node['values'].split(',').map { |value| value.to_i(16) } + else + [] + end end end end