lib/whois/scanners/base.rb in whois-parser-1.2.0 vs lib/whois/scanners/base.rb in whois-parser-2.0.0
- old
+ new
@@ -35,19 +35,19 @@
tokenizer :skip_empty_line do
@input.skip(/^\n/)
end
tokenizer :skip_blank_line do
- @input.skip(/^[\s]*\n/)
+ @input.skip(/^\s*\n/)
end
tokenizer :skip_newline do
@input.skip(/\n/)
end
# Scan a key/value pair and stores the result in the current target.
- # target is the global @ast if no '_section' is set, else '_section' is used.
+ # target is the global @ast if no '_section' is set, else '_section' is used.
tokenizer :scan_keyvalue do
if @input.scan(/(.+?):(.*?)(\n|\z)/)
key, value = @input[1].strip, @input[2].strip
target = @tmp['_section'] ? (@ast[@tmp['_section']] ||= {}) : @ast
@@ -58,11 +58,11 @@
target[key] << value
end
end
end
- protected
+ protected
def _scan_lines_to_array(pattern)
results = []
while @input.scan(pattern)
@input[1].strip
@@ -71,13 +71,11 @@
results
end
def _scan_lines_to_hash(pattern)
results = {}
- while @input.scan(pattern)
- results.merge! @input[1].strip => @input[2].strip
- end
+ results.merge! @input[1].strip => @input[2].strip while @input.scan(pattern)
results
end
def _scan_keyvalues(pattern)
results = []
@@ -111,6 +109,6 @@
end
end
end
-end
\ No newline at end of file
+end