Skip to content

Commit

Permalink
Remove trailing whitespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
semaperepelitsa committed Feb 19, 2011
1 parent 15ceafd commit 58d020d
Show file tree
Hide file tree
Showing 19 changed files with 72 additions and 72 deletions.
50 changes: 25 additions & 25 deletions lib/whois/answer/parser/scanners/iana.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
# License:: MIT License
#
#--
#
#
#++


module Whois
class Answer
class Parser
module Scanners

class Iana

def initialize(content)
@input = StringScanner.new(content)
end

def parse
@ast = {}
while !@input.eos?
Expand All @@ -33,22 +33,22 @@ def parse
end
@ast
end

private

def parse_content
parse_disclaimer ||
parse_section ||
error("Unexpected token")
end

def trim_newline
@input.scan(/\n/)
end

def parse_section
if @input.scan(/^(.+):(.+)\n/)

# Adapt the section's name depending on the first line
section = case @input[1].strip
when 'contact'
Expand All @@ -60,45 +60,45 @@ def parse_section
else
@input[1].strip # Default name is the first label found
end

content = parse_section_pairs
@input.match?(/\n+/) || error("Unexpected end of section")
@ast[section] = content
else
false
end
end

def parse_section_pairs
# Sets by default the firsts values found in the section parsing bellow
section_name, section_value = @input[1].strip, @input[2].strip
#contents = {section_name => section_value}
#contents = {section_name => section_value}

contents = {}

while content = parse_section_pair
contents.merge!(content)
end

if contents.has_key? section_name
contents[section_name].insert(0, "#{section_value}\n")
contents[section_name].insert(0, "#{section_value}\n")
else
contents[section_name] = section_value
end

if !contents.empty?
contents
else
false
end
end


def parse_section_pair
if @input.scan(/^(.+):\s*(.+)\n/)
key = @input[1].strip
values = [@input[2].strip]

while value = parse_section_pair_newlinevalue(key)
values << value
end
Expand All @@ -107,16 +107,16 @@ def parse_section_pair
false
end
end


def parse_section_pair_newlinevalue(key)
if @input.scan(/^#{key}:\s*(.+)\n/)
@input[1].strip
else
false
end
end

def parse_disclaimer
if @input.match?(/^\%(.*?)\n/)
disclaimer = []
Expand All @@ -133,11 +133,11 @@ def parse_disclaimer
def error(message)
if @input.eos?
raise "Unexpected end of input."
else
else
raise "#{message}: #{@input.peek(@input.string.length)}"
end
end

end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/whois/answer/parser/scanners/verisign.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Whois
class Answer
class Parser
module Scanners

class Verisign

def initialize(content)
Expand Down Expand Up @@ -117,7 +117,7 @@ def parse_pair
end

end

end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/whois/answer/parser/whois.centralnic.com.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class WhoisCentralnicCom < Base
# raise ParserError, "Unexpected response trying to parse `:domain' property. The parser might be outdated."
# end
# end
#
#
# property_not_supported :domain_id


Expand Down
2 changes: 1 addition & 1 deletion lib/whois/answer/parser/whois.denic.de.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def parse_invalid
if @input.match?(/% ".*" is not a valid domain name\n/)
@input.scan(/%.*\n/)
@ast["Invalid"] = true
end
end
end

def parse_db_time
Expand Down
4 changes: 2 additions & 2 deletions lib/whois/answer/parser/whois.na-nic.com.na.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ class WhoisNaNicComNa < Base
Time.parse($1)
end
end

property_supported :updated_on do
if content_for_scanner =~ /Modified:\s+(.+?)\n/
Time.parse($1)
end
end

property_supported :expires_on do
if content_for_scanner =~ /Expires:\s+(.+?)\n/
Time.parse($1)
Expand Down
4 changes: 2 additions & 2 deletions lib/whois/answer/parser/whois.nic.ag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class WhoisNicAg < Base
Time.parse($1)
end
end

property_supported :updated_on do
if content_for_scanner =~ /Last Updated On:(.*?)\n/
Time.parse($1)
end
end

property_supported :expires_on do
if content_for_scanner =~ /Expiration Date:(.*?)\n/
Time.parse($1)
Expand Down
4 changes: 2 additions & 2 deletions lib/whois/answer/parser/whois.nic.gl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ class WhoisNicGl < Base
Time.parse($1)
end
end

property_supported :updated_on do
if content_for_scanner =~ /Modified:\s+(.+?)\n/
Time.parse($1)
end
end

property_supported :expires_on do
if content_for_scanner =~ /Expires:\s+(.+?)\n/
Time.parse($1)
Expand Down
4 changes: 2 additions & 2 deletions lib/whois/answer/parser/whois.nic.ki.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ class WhoisNicKi < Base
Time.parse($1)
end
end

property_supported :updated_on do
if content_for_scanner =~ /Modified:\s+(.+?)\n/
Time.parse($1)
end
end

property_supported :expires_on do
if content_for_scanner =~ /Expires:\s+(.+?)\n/
Time.parse($1)
Expand Down
4 changes: 2 additions & 2 deletions lib/whois/answer/parser/whois.nic.mg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ class WhoisNicMg < Base
Time.parse($1)
end
end

property_supported :updated_on do
if content_for_scanner =~ /Modified:\s+(.+?)\n/
Time.parse($1)
end
end

property_supported :expires_on do
if content_for_scanner =~ /Expires:\s+(.+?)\n/
Time.parse($1)
Expand Down
4 changes: 2 additions & 2 deletions lib/whois/answer/parser/whois.nic.ms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ class WhoisNicMs < Base
Time.parse($1)
end
end

property_supported :updated_on do
if content_for_scanner =~ /Modified:\s+(.+?)\n/
Time.parse($1)
end
end

property_supported :expires_on do
if content_for_scanner =~ /Expires:\s+(.+?)\n/
Time.parse($1)
Expand Down
4 changes: 2 additions & 2 deletions lib/whois/answer/parser/whois.nic.net.nf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ class WhoisNicNetNf < Base
Time.parse($1)
end
end

property_supported :updated_on do
if content_for_scanner =~ /Modified:\s+(.+?)\n/
Time.parse($1)
end
end

property_supported :expires_on do
if content_for_scanner =~ /Expires:\s+(.+?)\n/
Time.parse($1)
Expand Down
4 changes: 2 additions & 2 deletions lib/whois/answer/parser/whois.nic.net.ng.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ class WhoisNicNetNg < Base
Time.parse($1)
end
end

property_supported :updated_on do
if content_for_scanner =~ /Modified:\s+(.+?)\n/
Time.parse($1)
end
end

property_supported :expires_on do
if content_for_scanner =~ /Expires:\s+(.+?)\n/
Time.parse($1)
Expand Down
2 changes: 1 addition & 1 deletion lib/whois/answer/parser/whois.ripn.net.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class WhoisRipnNet < Base


# Nameservers are listed in the following formats:
#
#
# nserver: ns.masterhost.ru.
# nserver: ns.masterhost.ru. 217.16.20.30
#
Expand Down
2 changes: 1 addition & 1 deletion lib/whois/answer/super_struct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ def initialize_with_hash(attributes = {})
self[key] = value
end
end

end
6 changes: 3 additions & 3 deletions lib/whois/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def self.factory(type, allocation, host, options = {})
options = options.dup
(options.delete(:adapter) || Adapters::Standard).new(type, allocation, host, options)
end


# Parses <tt>string</tt> and tries to guess the right server.
#
# It successfully detects the following query types:
Expand Down Expand Up @@ -209,7 +209,7 @@ def self.guess(string)
if matches_tld?(string)
return factory(:tld, ".", "whois.iana.org")
end

# IP address (secure match)
if matches_ip?(string)
return find_for_ip(string)
Expand Down
2 changes: 1 addition & 1 deletion lib/whois/server/adapters/pir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def request(string)
private

def extract_referral(response)
if response =~ /Registrant Name:SEE SPONSORING REGISTRAR/ &&
if response =~ /Registrant Name:SEE SPONSORING REGISTRAR/ &&
response =~ /Registrant Street1:Whois Server:(\S+)/
$1
end
Expand Down
Loading

0 comments on commit 58d020d

Please sign in to comment.