Skip to content

Commit

Permalink
Refactored current_zone_allow_transfer.
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger authored and mvidner committed May 27, 2016
1 parent 05f909f commit abbce87
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/include/dns-server/dialog-masterzone.rb
Expand Up @@ -202,18 +202,16 @@ def GetMasterZoneEditorTabBasics

# @return [Array<String>]
def current_zone_allow_transfer
items = []
@current_zone.fetch("options", []).each do |m|
if m["key"] == "allow-transfer"
key = m.fetch("value", "")
key = key[/\A.*\{[ \t]*(.*)[ \t]*\}.*\z/, 1]
if key != nil
items = key.split(/[ \t;]/).find_all{|i| !i.empty?}
break
end
end
target_pair = @current_zone.fetch("options", []).find do |m|
m["key"] == "allow-transfer"
end
items
return [] unless target_pair

value = target_pair["value"] || ""
value = value[/\A.*\{[ \t]*(.*)[ \t]*\}.*\z/, 1]
return [] unless value

value.split(/[ \t;]/).reject(&:empty?)
end

def ZoneAclInit
Expand Down

0 comments on commit abbce87

Please sign in to comment.