lib/ronin/product.rb in ronin-0.2.4 vs lib/ronin/product.rb in ronin-0.3.0
- old
+ new
@@ -1,9 +1,7 @@
#
-#--
-# Ronin - A Ruby platform designed for information security and data
-# exploration tasks.
+# Ronin - A Ruby platform for exploit development and security research.
#
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,11 +14,10 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#++
#
require 'ronin/model'
require 'rexml/document'
@@ -44,34 +41,37 @@
# Validates
validates_present :name, :version
#
- # Creates a new Product object with the given _attributes_.
+ # Creates a new Product object.
#
- # _attributes_ must contain the following keys:
- # <tt>:name</tt>:: The name of the product.
- # <tt>:vendor</tt>:: The vendor of the product. Will default to the
- # product name, if not given.
+ # @param [Hash] attributes
+ # Attributes of the product.
#
- # _attributes_ may contain the following keys:
- # <tt>:version</tt>:: The version of the product.
+ # @option attributes [String] :name
+ # The name of the product.
#
+ # @option attributes [String] :vendor
+ # The vendor of the product.
+ #
+ # @option attributes [String] :version
+ # The vesion of the product.
+ #
def initialize(attributes={})
attributes[:vendor] ||= attributes[:name]
super(attributes)
end
#
- # Returns the String form of the product.
+ # Converts the product to a String.
#
+ # @return [String]
+ # The product vendor, name and version.
+ #
def to_s
- unless self.vendor == self.name
- return "#{self.vendor} #{self.name} #{self.version}"
- else
- return "#{self.name} #{self.version}"
- end
+ [self.vendor, self.name, self.version].compact.join(' ')
end
end
end