1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

fix some bugs & rename confusing function name

This commit is contained in:
Freddy Chu 2015-04-17 17:45:03 +08:00
parent ff72924210
commit fddd1b0eb8

View file

@ -59,10 +59,12 @@ module Fog
end end
class Mock class Mock
def set_identified_records(record, zone, name) def list_all_records(record, zone, name)
[].tap do |tmp_records| [].tap do |tmp_records|
tmp_records.push(record) if name.nil? || (!record[:name].nil? && record[:name].gsub(zone[:name],"") >= name)
record.each do |key,subr| record.each do |key,subr|
if subr.is_a?(Hash) && key.start_with?(Fog::DNS::AWS::Mock::SET_PREFIX) if subr.is_a?(Hash) && key.is_a?(String) &&
key.start_with?(Fog::DNS::AWS::Mock::SET_PREFIX)
if name.nil? if name.nil?
tmp_records.append(subr) tmp_records.append(subr)
else else
@ -95,12 +97,11 @@ module Fog
name = options[:name].gsub(zone[:name],"") name = options[:name].gsub(zone[:name],"")
records.each do |r| records.each do |r|
tmp_records.append(r) if !r[:name].nil? && r[:name].gsub(zone[:name],"") >= name tmp_records += list_all_records(r, zone, name)
tmp_records += set_identified_records(r, zone, name)
end end
else else
records.each do |r| records.each do |r|
tmp_records += set_identified_records(r, zone, nil) tmp_records += list_all_records(r, zone, nil)
end end
end end
records = tmp_records records = tmp_records