Permalink
Browse files

Deprecate initialization without Hash

  • Loading branch information...
weppos committed May 28, 2012
1 parent fe58b0b commit 2dad3d3ce4086560bdd253c0bd701eeaffdabfd0
@@ -81,7 +81,7 @@ class BaseCocca < Base
property_supported :nameservers do
if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
$1.split("\n").map do |name|
- Record::Nameserver.new(name.strip)
+ Record::Nameserver.new(:name => name.strip)
end
end
end
@@ -44,17 +44,18 @@ def initialize(*args)
if args.first.is_a? Hash
initialize_with_hash(args.first)
else
+ Whois.deprecate "Passing a list of arguments to #{self.class} is deprecated, please use the Hash syntax."
super
end
yield(self) if block_given?
end
- private
+private
- def initialize_with_hash(attributes = {})
- attributes.each do |key, value|
- self[key] = value
- end
+ def initialize_with_hash(attributes = {})
+ attributes.each do |key, value|
+ self[key] = value
end
+ end
end
@@ -12,7 +12,6 @@
describe "#initialize" do
it "initializes a new instance from given hash" do
i = SuperEroe.new(:name => "Pippo", :supername => "SuperPippo")
-
i.name.should == "Pippo"
i.supername.should == "SuperPippo"
end

0 comments on commit 2dad3d3

Please sign in to comment.