Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Deprecate initialization without Hash

  • Loading branch information...
commit 2dad3d3ce4086560bdd253c0bd701eeaffdabfd0 1 parent fe58b0b
@weppos authored
View
2  lib/whois/record/parser/base_cocca.rb
@@ -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
View
11 lib/whois/record/super_struct.rb
@@ -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
View
1  spec/whois/record/super_struct_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.