lib/ronin/platform.rb in ronin-0.0.9 vs lib/ronin/platform.rb in ronin-0.1.0
- old
+ new
@@ -35,10 +35,13 @@
property :os, String
# Version of the Operating System
property :version, String
+ # Validates
+ validates_present :os, :version
+
#
# Returns the String form of the Platform.
#
# platform = Platform.new("Linux","2.6.11")
# platform.to_s # => "Linux 2.6.11"
@@ -70,10 +73,10 @@
def Platform.define(name)
name = name.to_s
method_name = name.to_method_name
meta_def(method_name) do
- Platform.find_or_new(:os => name)
+ Platform.new(:os => name)
end
meta_def("#{method_name}_version") do |version|
Platform.first_or_create(:os => name, :version => version.to_s)
end