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

- old
+ new

@@ -13,20 +13,12 @@ # Creates a new OS object. # # @param [Nokogiri::XML::Node] node # The node that contains the OS guessing information. # - # @yield [os] - # If a block is given, it will passed the newly created OS object. - # - # @yieldparam [OS] os - # The newly created OS object. - # def initialize(node) @node = node - - yield self if block_given? end # # Parses the OS class information. # @@ -41,18 +33,11 @@ # will be returned. # def each_class return enum_for(__method__) unless block_given? - @node.xpath("osclass").map do |osclass| - os_class = OSClass.new( - osclass['type'].to_sym, - osclass['vendor'], - osclass['osfamily'].to_sym, - osclass['accuracy'].to_i - ) - - yield os_class + @node.xpath("osmatch/osclass").each do |osclass| + yield OSClass.new(osclass) end return self end