Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix adapters from JSON definitions being ignored. #203

Merged
merged 1 commit into from

2 participants

@linrock

All whois queries currently just use the Standard adapter since Whois::Server.factory looks for the adapter option as a symbol, but JSON parses keys as strings by default. Fixed so that the proper adapters are used again.

@weppos
Owner

Thanks @linrock for pointing it out!

@weppos weppos merged commit dd56b67 into from
@weppos weppos referenced this pull request from a commit
@weppos Convert options to Symbol when loading the JSON.
Alternative solution to GH-203.
ef589d3
@weppos
Owner

@linrock I changed the implementation a little bit to convert the options when the file is loaded (to save memory) and I added a test.

Thanks for reporting the issue.

@linrock

Sounds good! Just needed to get a quick fix in to pave way for #204.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 5, 2013
  1. @linrock
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/whois/server.rb
View
2  lib/whois/server.rb
@@ -179,7 +179,7 @@ def self.define(type, allocation, host, options = {})
# An adapter that can be used to perform queries.
#
def self.factory(type, allocation, host, options = {})
- options = options.dup
+ options = Hash[options.map {|k,v| [k.to_sym, v] }]
adapter = options.delete(:adapter) || Adapters::Standard
adapter = Adapters.const_get(camelize(adapter)) unless adapter.respond_to?(:new)
adapter.new(type, allocation, host, options)
Something went wrong with that request. Please try again.